From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 087403A1E7A for ; Fri, 26 Dec 2025 09:01:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766739714; cv=none; b=g6h4NOD1KYNkytBdpRcKyiJtcS7IAPB63yLM14POzF4TWTk3EmYOHvBMQzmP+lPG7j1OQx0HR7D/Jum16HIbuU8J0Vu/KzGCXvN2VzcL2yZQwaGF7i2yiCI8EvUu9zO7skoVa9av1aO2Zi3ZfVt9x/WNR6CUfpRVniayDa6Q2ac= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766739714; c=relaxed/simple; bh=ERuYmbJFSvy/5XGFKHlbkWpfVmZbmKFMhOETljSlHvY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kGISFPPFxWCovEgYqorkOSPmSRS5B+nmOWgTT6IIpMGDcKJDDPLknTZv8/lF0qGwYrYzeV7HRE+VUwD+QibYaEIqifqpC3/WgA7fTHvBxMzPsv+QmIeHcQvUEeBzWJGSx9AwgauP3Bc3O6k7v0VSmC5Z9cpmpTue5t7A42w6ap0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=HG1s4OpV; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="HG1s4OpV" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id CE08C1A2441; Fri, 26 Dec 2025 09:01:47 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id A37C5606E4; Fri, 26 Dec 2025 09:01:47 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 11931103C8C77; Fri, 26 Dec 2025 10:01:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1766739707; h=from:subject:date:message-id:to:cc:mime-version:content-type: in-reply-to:references; bh=jW3rYpO7G9DB2SEgQOY2MYoGbEo4nUxbYVDx/hk4E0s=; b=HG1s4OpVsIzPf6YCOYn8mgNm0jCHwq8j10CqoI1Bv49OnTUN5IeJc1GdY8UvjEgqzgRclk YSFOJbvJ1rohW62x0Me9AC92cyFnWgEIcyc51FXzHJUhVV2z+z2aXXdfbmmnU2UMWhl6mh UoQZhZGAQQa/J7ox+nMoZrJiWNASjWt7LvgB7LIMQV7nIqfXc5Gs0iBasHSLELAl9a0D5+ Q2Mi0SuGcNc8QhbI1JeIJcM8O5RQbjkrvZ06JSBJce/IkZfSjTeThkS2AxWlhVbX8YmLeb KSIOdPJ1jYVVUk3QX0C/9lE5CXat6lQ+53TFhA3CgIknr5yetiIH8tNv8Rr4Xg== From: Romain Gantois To: Felix Gu Cc: gregkh@linuxfoundation.org, arnd@arndb.de, linux-kernel@vger.kernel.org, Felix Gu Subject: Re: [PATCH] misc:ti_fpc202:fix a potential memory leak in probe function Date: Fri, 26 Dec 2025 10:01:39 +0100 Message-ID: <5036254.GXAFRqVoOG@fw-rgant> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2247712.irdbgypaU6"; micalg="pgp-sha512"; protocol="application/pgp-signature" X-Last-TLS-Session-Version: TLSv1.3 --nextPart2247712.irdbgypaU6 Content-Type: multipart/alternative; boundary="nextPart1942149.tdWV9SEqCh"; protected-headers="v1" Content-Transfer-Encoding: 7Bit From: Romain Gantois To: Felix Gu Date: Fri, 26 Dec 2025 10:01:39 +0100 Message-ID: <5036254.GXAFRqVoOG@fw-rgant> In-Reply-To: References: MIME-Version: 1.0 This is a multi-part message in MIME format. --nextPart1942149.tdWV9SEqCh Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" 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 > --- > 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 --nextPart1942149.tdWV9SEqCh Content-Transfer-Encoding: 7Bit Content-Type: text/html; charset="utf-8"

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@qq.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@bootlin.com>



--nextPart1942149.tdWV9SEqCh-- --nextPart2247712.irdbgypaU6 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEIcCsAScRrtr7W0x0KCYAIARzeA4FAmlOTvMACgkQKCYAIARz eA5s3Q/+PR6B3v0rOLbH/t5dobLpZabvCSa2Ap5d4tnt5qqZIn/aw5LoLzL9IyFP V4+5N6xOSLVV7kA8cxJFfsHUpOHVaExY5HwL8cxdusxPlfHRtTgu1LSeFEyyh7Gc ZZXsRr3egSk8Oud3OnGPMJf94datkRGWVrnHSUH+J+jKMme5gUlbCOx6rTRAdbjs 52B0w7c4s0les6j+H1trdO/aEVT6PGyXz9nCIo7mCO/gETaXFoH9QL24BLIMNkkY zBd80B5AVqw4PLWU+2ITHyFw2zOB7rFEoZ+gKfJ+UJuAnLaIGRuL7lOHO3NnadMY +RTrUjYwuVsf9HvDKva5nyWqbL3S70XkDK5/QICJ3eV6GY4wTzdg5kPvz0yybM5m Yv17FhAB+5Jue2n1LupmaoHWDOiiKaF2L9fZrj6y26z9i4PbMID7zaIHf0WlERkc 4uP29+7HXHc7kxA1LcefetGEVLkDQAJTBtFDniVoQSexC7zRWXVZG1HpeZR5/A2V 5/ejtmrYktUnsXrcYg+OwCwB/29D5kQT9teWZvYnr9PUsaZW47S1TcJUzVq/rZzk 3ygWegA6UhkZnqtO0uk7Xrao4XXLUdwL04mmKuU7hAgju34Is64TDwa96WoUzCHd UHcCWoHOGw3XMh+dIHJ2eIthWIKc/djMiQCE5MmEt4trSF/PcZo= =X/DS -----END PGP SIGNATURE----- --nextPart2247712.irdbgypaU6--