Re: [PATCH] i2c: ocores: Disable clock on failed resume

Max Filippov <[email protected]>
Newsgroups org.kernel.vger.linux-kernel,org.kernel.vger.linux-i2c
Message-ID <CAMo8BfJpittF0accyBWPHaDt6M816Jj-btp1=raZG7aAC6Kbzg@mail.gmail.com>
On Thu, Aug 13, 2026 at 8:32 AM Ruoyu Wang <[email protected]> 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 <[email protected]>
> ---
>  drivers/i2c/busses/i2c-ocores.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Reviewed-by: Max Filippov <[email protected]>

-- 
Thanks.
-- Max
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.