Re: [PATCH v5 1/2] i2c: imx-lpi2c: properly unwind resources on probe failure
From: Carlos Song
Date: Tue Jul 14 2026 - 22:52:43 EST
On Tue, Jul 14, 2026 at 04:10:20PM +0200, Markus Elfring wrote:
> …
> > Introduce a new error label 'clk_disable' …
>
> Can another bit of duplicate source code be avoided in any if branches?
>
> Regards,
> Markus
>
Thank you! I plan to change the code like this:
'''
ret = devm_clk_rate_exclusive_get(&pdev->dev, lpi2c_imx->clks[0].clk);
if (ret) {
ret = dev_err_probe(&pdev->dev, ret,
"can't lock I2C peripheral clock rate\n");
goto clk_disable;
}
lpi2c_imx->rate_per = clk_get_rate(lpi2c_imx->clks[0].clk);
if (!lpi2c_imx->rate_per) {
ret = dev_err_probe(&pdev->dev, -EINVAL,
"can't get I2C peripheral clock rate\n");
goto clk_disable;
}
'''
Does it look better?
Carlos Song