[<prev] [next>] [day] [month] [year] [list]
Message-ID: <354bf00a245ec3bac9cdd197a06138dddda2f009.1753904271.git.christophe.jaillet@wanadoo.fr>
Date: Wed, 30 Jul 2025 21:38:02 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Peter Rosin <peda@...ntia.se>,
Andi Shyti <andi.shyti@...nel.org>,
Farouk Bouabid <farouk.bouabid@...rry.de>,
Wolfram Sang <wsa+renesas@...g-engineering.com>
Cc: linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
linux-i2c@...r.kernel.org
Subject: [PATCH] i2c: muxes: mule: Fix an error handling path in mule_i2c_mux_probe()
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@...adoo.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", ®);
--
2.50.1
Powered by blists - more mailing lists