Unverified Commit 9eb9f7c3 authored by Artem Shimko's avatar Artem Shimko Committed by Andi Shyti
Browse files

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: default avatarArtem Shimko <a.shimko.dev@gmail.com>
Acked-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarAndi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260130111039.874548-3-a.shimko.dev@gmail.com
parent 78821a75
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -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;

exit_probe:
	if (ret) {
		dw_i2c_plat_pm_cleanup(dev);
		i2c_dw_prepare_clk(dev, false);
	}

	return ret;
}