Re: [PATCH 6/8] i2c: nomadik: handle pm_runtime errors
From: Wolfram Sang
Date: Thu Nov 05 2026 - 03:51:21 EST
On Thu, Nov 05, 2026 at 09:42:02AM +0100, Linus Walleij wrote:
> On Tue, Nov 3, 2026 at 9:30 AM Dmitry Guzman <Dmitry.Guzman@xxxxxxxxxxxx> wrote:
>
> > In nmk_i2c_xfer(), pm_runtime_get_sync() is called on start and then
> > the controller registers are accessed without checking the return value.
> > If pm_runtime_get_sync() fails, access to the register of the device that
> > was not correctly powered on may cause a bus fault or other unpredictable
> > system behavior.
> >
> > Check the return value of pm_runtime_get_sync() and it if is not 0,
> > return the error immediately.
> >
> > Signed-off-by: Dmitry Guzman <Dmitry.Guzman@xxxxxxxxxxxx>
> (...)
> > - pm_runtime_get_sync(&priv->adev->dev);
> > + i = pm_runtime_get_sync(&priv->adev->dev);
> > + if (i)
> > + return i;
>
> It's a bit odd to reuse the i (= iterator...) variable for this.
> I would just add an int ret or int err for this.
Yes, please.