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>
---
drivers/i2c/busses/i2c-designware-platdrv.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 88e70970c72c..74246fcd5138 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -292,14 +292,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;
}
--
2.43.0