Re: [PATCH] leds: sgm3140: Put the child node reference on success
From: Nguyễn Công
Date: Thu Nov 26 2026 - 07:28:39 EST
On Wed, Nov 25, 2026 at 10:15 PM Markus Elfring <Markus.Elfring@xxxxxx> wrote:
>
> …
> > Put the reference before returning success.
>
> Please avoid a bit of duplicate source.
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v7.4-rc4#n526
>
Hi Markus,
Agreed on the duplicate, v2 drops it and uses the common exit:
https://lore.kernel.org/r/20261126122516.1198461-1-congnt264@xxxxxxxxx
>
> How do you think about to apply the attribute “__free(fwnode_handle_put)”
> also in the implementation of the function “sgm3140_probe”?
> https://elixir.bootlin.com/linux/v7.4-rc1/source/include/linux/property.h#L229
> https://elixir.bootlin.com/linux/v7.4-rc1/source/drivers/leds/flash/leds-sgm3140.c#L185-L281
I kept fwnode_handle_put() rather than __free(fwnode_handle) because
this has a Fixes tag and may be backported, and the __free() helper
only exists since v6.10.
Thanks,
Cong
>
> Regards,
> Markus