Re: [PATCH] Input: Fix i2c_bus OF node reference leak in ppkb_probe()
From: Dmitry Torokhov
Date: Thu Sep 17 2026 - 11:23:13 EST
Hi Wentao,
On Wed, Sep 16, 2026 at 06:47:21PM +0000, Wentao Liang wrote:
> The device node reference returned by of_get_child_by_name() is
> stored as the adapter's of_node but never released, leaking one node
> reference on every probe, successful or not.
>
> The adapter only borrows the node, so drop the reference once the
> adapter has been added, and also on the error path.
I do not think this is correct fix. The node assigned to the adapter
should stay alive while the adapter is alive.
I think we should convert of_node to fwnode, use device_set_node() to
make sure both fwnode and of_node are pointing to the same thing, and
set up devm_add_action_or_reset() to free the fwnode at the right time.
Thanks.
--
Dmitry