[PATCH -next] mtd: rawnand: intel: Add missing of_node_put() in ebu_nand_probe()

Martin Blumenstingl martin.blumenstingl at googlemail.com
Sun Sep 25 12:39:03 PDT 2022


Hello,

On Sat, Sep 24, 2022 at 3:03 PM Yang Yingliang <yangyingliang at huawei.com> wrote:
>
> The 'chip_np' returned by of_get_next_child() with refcount decremented,
> of_node_put() need be called in error path to decrease the refcount.
Thanks a lot for bringing this up!

[...]
> @@ -695,6 +700,8 @@ static int ebu_nand_probe(struct platform_device *pdev)
>         ebu_dma_cleanup(ebu_host);
>  err_disable_unprepare_clk:
>         clk_disable_unprepare(ebu_host->clk);
> +err_of_node_put:
> +       of_node_put(chip_np);
Here I have one question:
My understanding is that with this patch we now use
of_node_put(chip_np); in case any error occurs during probe.
But what about the case where there's no error and someone later
unloads the driver (using rmmod)? Or in other words: do we need
another of_node_put() call in ebu_nand_remove()?


Best regards,
Martin



More information about the linux-mtd mailing list