Re: [PATCH] leds: rt4505: Put the child node reference

From: ChiYuan Huang

Date: Thu Nov 26 2026 - 00:41:16 EST


On Wed, Nov 25, 2026 at 08:03:18PM +0700, Cong Nguyen wrote:
> rt4505_probe() gets the LED child node with device_get_next_child_node(),
> which returns it with its reference count raised. The driver never calls
> fwnode_handle_put() on it, so the reference is leaked on every probe error
> after that point and on a successful probe once the device is removed.
> The v4l2 flash sub-device takes its own reference on the node, and the LED
> class device only stores the pointer.
>
> Drop the reference with a device managed action registered right after the
> node is taken, so it is released after the LED class device that was
> registered later has been unregistered. leds-rt8515 puts the node of the
> same kind after registering its LED and flash sub-device.
>
> Fixes: d9dfac5419d0 ("leds: rt4505: Add support for Richtek RT4505 flash LED controller")
> Signed-off-by: Cong Nguyen <congnt264@xxxxxxxxx>

Reviewed-by: ChiYuan Huang <cy_huang@xxxxxxxxxxx>