public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: Fix reference leak in of_i2c_register_devices
@ 2025-04-06 13:48 Sunny Patel
  2025-04-06 18:06 ` Christophe JAILLET
  0 siblings, 1 reply; 5+ messages in thread
From: Sunny Patel @ 2025-04-06 13:48 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, linux-kernel, Sunny Patel

Fix a potential reference leak in of_i2c_register_devices where the
reference to the node is not released if device registration fails.
This ensures proper reference management and avoids memory leaks.

Signed-off-by: Sunny Patel <nueralspacetech@gmail.com>
---
 drivers/i2c/i2c-core-of.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c
index 02feee6c9ba9..7c50905de8f1 100644
--- a/drivers/i2c/i2c-core-of.c
+++ b/drivers/i2c/i2c-core-of.c
@@ -107,6 +107,7 @@ void of_i2c_register_devices(struct i2c_adapter *adap)
 				 "Failed to create I2C device for %pOF\n",
 				 node);
 			of_node_clear_flag(node, OF_POPULATED);
+			of_node_put(node);
 		}
 	}
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-04-16 22:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-06 13:48 [PATCH] i2c: Fix reference leak in of_i2c_register_devices Sunny Patel
2025-04-06 18:06 ` Christophe JAILLET
     [not found]   ` <CAGNPQObiZA76gva-+_DY8TtpEiJfLL3QDoONYST4npOSkgZ+5g@mail.gmail.com>
2025-04-08 19:04     ` Christophe JAILLET
2025-04-14 15:42       ` Sunny Patel
2025-04-16 22:11         ` Christophe JAILLET

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox