]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
i2c: designware-platdrv: fix cleanup on probe failure
authorArtem Shimko <a.shimko.dev@gmail.com>
Fri, 30 Jan 2026 11:10:37 +0000 (14:10 +0300)
committerAndi Shyti <andi.shyti@kernel.org>
Thu, 5 Feb 2026 10:28:22 +0000 (11:28 +0100)
Simplify the error handling in dw_i2c_plat_probe() by consolidating
cleanup operations directly in the error path instead of using a
goto label.

This eliminates the goto statement, makes the error handling more
transparent, and reduces code indirection while maintaining identical
cleanup behavior on probe failure.

Signed-off-by: Artem Shimko <a.shimko.dev@gmail.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260130111039.874548-3-a.shimko.dev@gmail.com
drivers/i2c/busses/i2c-designware-platdrv.c

index f591da26916fbfc99637a9c4d98f7af8a4142300..426ffec06e221fe87687a2b619fb496460b0a065 100644 (file)
@@ -225,14 +225,11 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
        pm_runtime_enable(device);
 
        ret = i2c_dw_probe(dev);
-       if (ret)
-               goto exit_probe;
-
-       return ret;
+       if (ret) {
+               dw_i2c_plat_pm_cleanup(dev);
+               i2c_dw_prepare_clk(dev, false);
+       }
 
-exit_probe:
-       dw_i2c_plat_pm_cleanup(dev);
-       i2c_dw_prepare_clk(dev, false);
        return ret;
 }