]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
i2c: omap: Fix an error handling path in omap_i2c_probe()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 14 Jun 2025 14:59:26 +0000 (16:59 +0200)
committerAndi Shyti <andi.shyti@kernel.org>
Wed, 25 Jun 2025 22:07:33 +0000 (00:07 +0200)
If an error occurs after calling mux_state_select(), mux_state_deselect()
should be called as already done in the remove function.

Fixes: b6ef830c60b6 ("i2c: omap: Add support for setting mux")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: <stable@vger.kernel.org> # v6.15+
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/998542981b6d2435c057dd8b9fe71743927babab.1749913149.git.christophe.jaillet@wanadoo.fr
drivers/i2c/busses/i2c-omap.c

index f1cc26ac5b805bc5a5621931632d912dab9417d4..8b01df3cc8e956fe6a90be83cb73226a073c8eb6 100644 (file)
@@ -1461,13 +1461,13 @@ omap_i2c_probe(struct platform_device *pdev)
                if (IS_ERR(mux_state)) {
                        r = PTR_ERR(mux_state);
                        dev_dbg(&pdev->dev, "failed to get I2C mux: %d\n", r);
-                       goto err_disable_pm;
+                       goto err_put_pm;
                }
                omap->mux_state = mux_state;
                r = mux_state_select(omap->mux_state);
                if (r) {
                        dev_err(&pdev->dev, "failed to select I2C mux: %d\n", r);
-                       goto err_disable_pm;
+                       goto err_put_pm;
                }
        }
 
@@ -1515,6 +1515,9 @@ omap_i2c_probe(struct platform_device *pdev)
 
 err_unuse_clocks:
        omap_i2c_write_reg(omap, OMAP_I2C_CON_REG, 0);
+       if (omap->mux_state)
+               mux_state_deselect(omap->mux_state);
+err_put_pm:
        pm_runtime_dont_use_autosuspend(omap->dev);
        pm_runtime_put_sync(omap->dev);
 err_disable_pm: