* [PATCH] misc:ti_fpc202:fix a potential memory leak in probe function
@ 2025-12-25 15:02 Felix Gu
2025-12-26 9:01 ` Romain Gantois
0 siblings, 1 reply; 3+ messages in thread
From: Felix Gu @ 2025-12-25 15:02 UTC (permalink / raw)
To: romain.gantois; +Cc: gregkh, arnd, linux-kernel, Felix Gu
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.
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)
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] misc:ti_fpc202:fix a potential memory leak in probe function
2025-12-25 15:02 [PATCH] misc:ti_fpc202:fix a potential memory leak in probe function Felix Gu
@ 2025-12-26 9:01 ` Romain Gantois
2025-12-26 10:22 ` [PATCH v2] misc: ti_fpc202: fix " Felix Gu
0 siblings, 1 reply; 3+ messages in thread
From: Romain Gantois @ 2025-12-26 9:01 UTC (permalink / raw)
To: Felix Gu; +Cc: gregkh, arnd, linux-kernel, Felix Gu
[-- Attachment #1.1: Type: text/plain, Size: 1386 bytes --]
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>
[-- Attachment #1.2: Type: text/html, Size: 4646 bytes --]
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v2] misc: ti_fpc202: fix a potential memory leak in probe function
2025-12-26 9:01 ` Romain Gantois
@ 2025-12-26 10:22 ` Felix Gu
0 siblings, 0 replies; 3+ messages in thread
From: Felix Gu @ 2025-12-26 10:22 UTC (permalink / raw)
To: romain.gantois; +Cc: gregkh, arnd, linux-kernel, Felix Gu
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.
Signed-off-by: Felix Gu <gu_0233@qq.com>
Reviewed-by: Romain Gantois <romain.gantois@bootlin.com>
---
v2:
- Fixed spacing in the commit title ("misc: ti_fpc202: ...") as requested by Romain.
- Added Romain's Reviewed-by tag.
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)
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-26 10:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-25 15:02 [PATCH] misc:ti_fpc202:fix a potential memory leak in probe function Felix Gu
2025-12-26 9:01 ` Romain Gantois
2025-12-26 10:22 ` [PATCH v2] misc: ti_fpc202: fix " Felix Gu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®