public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: muxes: mule: Fix an error handling path in mule_i2c_mux_probe()
@ 2025-07-30 19:38 Christophe JAILLET
  2025-08-03 20:48 ` Wolfram Sang
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2025-07-30 19:38 UTC (permalink / raw)
  To: Peter Rosin, Andi Shyti, Farouk Bouabid, Wolfram Sang
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-i2c

If an error occurs in the loop that creates the device adapters, then a
reference to 'dev' still needs to be released.

Use for_each_child_of_node_scoped() to both fix the issue and save one line
of code.

Fixes: d0f8e97866bf ("i2c: muxes: add support for tsd,mule-i2c multiplexer")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only
---
 drivers/i2c/muxes/i2c-mux-mule.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/i2c/muxes/i2c-mux-mule.c b/drivers/i2c/muxes/i2c-mux-mule.c
index 284ff4afeeac..d3b32b794172 100644
--- a/drivers/i2c/muxes/i2c-mux-mule.c
+++ b/drivers/i2c/muxes/i2c-mux-mule.c
@@ -47,7 +47,6 @@ static int mule_i2c_mux_probe(struct platform_device *pdev)
 	struct mule_i2c_reg_mux *priv;
 	struct i2c_client *client;
 	struct i2c_mux_core *muxc;
-	struct device_node *dev;
 	unsigned int readback;
 	int ndev, ret;
 	bool old_fw;
@@ -95,7 +94,7 @@ static int mule_i2c_mux_probe(struct platform_device *pdev)
 				     "Failed to register mux remove\n");
 
 	/* Create device adapters */
-	for_each_child_of_node(mux_dev->of_node, dev) {
+	for_each_child_of_node_scoped(mux_dev->of_node, dev) {
 		u32 reg;
 
 		ret = of_property_read_u32(dev, "reg", &reg);
-- 
2.50.1


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

* Re: [PATCH] i2c: muxes: mule: Fix an error handling path in mule_i2c_mux_probe()
  2025-07-30 19:38 [PATCH] i2c: muxes: mule: Fix an error handling path in mule_i2c_mux_probe() Christophe JAILLET
@ 2025-08-03 20:48 ` Wolfram Sang
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2025-08-03 20:48 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Peter Rosin, Andi Shyti, Farouk Bouabid, linux-kernel,
	kernel-janitors, linux-i2c

On Wed, Jul 30, 2025 at 09:38:02PM +0200, Christophe JAILLET wrote:
> If an error occurs in the loop that creates the device adapters, then a
> reference to 'dev' still needs to be released.
> 
> Use for_each_child_of_node_scoped() to both fix the issue and save one line
> of code.
> 
> Fixes: d0f8e97866bf ("i2c: muxes: add support for tsd,mule-i2c multiplexer")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Applied to for-next (for 6.17 mergewindow), thanks!


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

end of thread, other threads:[~2025-08-03 20:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-30 19:38 [PATCH] i2c: muxes: mule: Fix an error handling path in mule_i2c_mux_probe() Christophe JAILLET
2025-08-03 20:48 ` Wolfram Sang

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