[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5036254.GXAFRqVoOG@fw-rgant>
Date: Fri, 26 Dec 2025 10:01:39 +0100
From: Romain Gantois <romain.gantois@...tlin.com>
To: Felix Gu <gu_0233@...com>
Cc: gregkh@...uxfoundation.org, arnd@...db.de, linux-kernel@...r.kernel.org,
Felix Gu <gu_0233@...com>
Subject:
Re: [PATCH] misc:ti_fpc202:fix a potential memory leak in probe function
Hello Felix,
On Thursday, 25 December 2025 16:02:56 CET Felix Gu wrote:
> Use for_each_child_of_node_scoped() to simplify the code and ensure the
> device node reference is automatically released when the loop scope
> ends.
>
Nit: please put spaces between the tags in the commit log title, like so:
"misc: ti_fpc202: fix a potential memory leak ..."
> Signed-off-by: Felix Gu <gu_0233@...com>
> ---
> drivers/misc/ti_fpc202.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/misc/ti_fpc202.c b/drivers/misc/ti_fpc202.c
> index 7964e46c7448..8eb2b5ac9850 100644
> --- a/drivers/misc/ti_fpc202.c
> +++ b/drivers/misc/ti_fpc202.c
> @@ -309,7 +309,6 @@ static void fpc202_remove_port(struct fpc202_priv *priv,
> int port_id) static int fpc202_probe(struct i2c_client *client)
> {
> struct device *dev = &client->dev;
> - struct device_node *i2c_handle;
> struct fpc202_priv *priv;
> int ret, port_id;
>
> @@ -357,7 +356,7 @@ static int fpc202_probe(struct i2c_client *client)
>
> bitmap_zero(priv->probed_ports, FPC202_NUM_PORTS);
>
> - for_each_child_of_node(dev->of_node, i2c_handle) {
> + for_each_child_of_node_scoped(dev->of_node, i2c_handle) {
> ret = of_property_read_u32(i2c_handle, "reg", &port_id);
> if (ret) {
> if (ret == -EINVAL)
With the above fixed:
Reviewed-by: Romain Gantois <romain.gantois@...tlin.com>
Content of type "text/html" skipped
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists