Re: [PATCH] i2c: ocores: Disable clock on failed resume
From: Max Filippov
Date: Thu Aug 13 2026 - 17:36:07 EST
On Thu, Aug 13, 2026 at 8:32 AM Ruoyu Wang <ruoyuw560@xxxxxxxxx> wrote:
>
> ocores_i2c_resume() enables the controller clock before reinitializing
> the hardware. If the clock rate changed while the device was suspended,
> ocores_init() may reject the resulting prescaler. The callback then
> returns an error with the clock still enabled, while the controller
> itself remains disabled.
>
> Disable and unprepare the clock when ocores_init() fails so the failed
> resume path balances the successful clk_prepare_enable() call.
>
> This issue was found by a static analysis checker and confirmed by manual
> source review.
>
> Fixes: e961a094afe0 ("i2c: ocores: add common clock support")
> Signed-off-by: Ruoyu Wang <ruoyuw560@xxxxxxxxx>
> ---
> drivers/i2c/busses/i2c-ocores.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
Reviewed-by: Max Filippov <jcmvbkbc@xxxxxxxxx>
--
Thanks.
-- Max