Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Artem Shimko and committed by
Andi Shyti
9eb9f7c3 78821a75

+4 -7
+4 -7
drivers/i2c/busses/i2c-designware-platdrv.c
··· 225 225 pm_runtime_enable(device); 226 226 227 227 ret = i2c_dw_probe(dev); 228 - if (ret) 229 - goto exit_probe; 228 + if (ret) { 229 + dw_i2c_plat_pm_cleanup(dev); 230 + i2c_dw_prepare_clk(dev, false); 231 + } 230 232 231 - return ret; 232 - 233 - exit_probe: 234 - dw_i2c_plat_pm_cleanup(dev); 235 - i2c_dw_prepare_clk(dev, false); 236 233 return ret; 237 234 } 238 235