Skip to content

Commit 9eb9f7c

Browse files
Artem ShimkoAndi Shyti
authored andcommitted
i2c: designware-platdrv: fix cleanup on probe failure
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
1 parent 78821a7 commit 9eb9f7c

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

drivers/i2c/busses/i2c-designware-platdrv.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,11 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
225225
pm_runtime_enable(device);
226226

227227
ret = i2c_dw_probe(dev);
228-
if (ret)
229-
goto exit_probe;
230-
231-
return ret;
228+
if (ret) {
229+
dw_i2c_plat_pm_cleanup(dev);
230+
i2c_dw_prepare_clk(dev, false);
231+
}
232232

233-
exit_probe:
234-
dw_i2c_plat_pm_cleanup(dev);
235-
i2c_dw_prepare_clk(dev, false);
236233
return ret;
237234
}
238235

0 commit comments

Comments
 (0)