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
This commit is contained in:
Artem Shimko 2026-01-30 14:10:37 +03:00 committed by Andi Shyti
parent 78821a753f
commit 9eb9f7c304
No known key found for this signature in database
GPG Key ID: DA78056626D32D6E

View File

@ -225,15 +225,12 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
pm_runtime_enable(device);
ret = i2c_dw_probe(dev);
if (ret)
goto exit_probe;
if (ret) {
dw_i2c_plat_pm_cleanup(dev);
i2c_dw_prepare_clk(dev, false);
}
return ret;
exit_probe:
dw_i2c_plat_pm_cleanup(dev);
i2c_dw_prepare_clk(dev, false);
return ret;
}
static void dw_i2c_plat_remove(struct platform_device *pdev)