Re: [PATCH] i2c: mv64xxx: Check clk_prepare_enable() return value in runtime resume

From: Andi Shyti

Date: Wed Oct 28 2026 - 12:57:01 EST


Hi Tang,

On Mon, Oct 26, 2026 at 07:36:45PM +0800, Tang Bin wrote:
> mv64xxx_i2c_runtime_resume() calls clk_prepare_enable() for both
> drv_data->clk and drv_data->reg_clk without checking the return value.
> If either clock fails to enable, the function returns 0 (success) and
> the driver proceeds to call reset_control_reset() and
> mv64xxx_i2c_hw_init() which access hardware registers without clocks
> enabled, potentially causing a bus hang.
>
> Additionally, if the second clk_prepare_enable() fails, the first clock
> is left enabled without being disabled on the error path.
>
> Fix this by checking both return values and properly cleaning up the
> first clock if the second fails.
>
> Fixes: e5c02cf54154 ("i2c: mv64xxx: Add runtime PM support")
> Signed-off-by: Tang Bin <tangbin@xxxxxxxxxxxxxxxxxxxx>

pushed to i2c/i2c.

Thanks,
Andi