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

Yang Yingliang yangyingliang at huawei.com
Sun Sep 25 18:57:00 PDT 2022


Hi,

On 2022/9/26 3:39, Martin Blumenstingl wrote:
> 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()?
In normal case, when the module is removing, the of_node_put() is
called in del_mtd_device() which is called by mtd_device_unregister().

Thanks,
Yang
>
>
> Best regards,
> Martin
> .



More information about the linux-mtd mailing list