Re: [PATCH 6/8] i2c: nomadik: handle pm_runtime errors

From: Linus Walleij

Date: Thu Nov 05 2026 - 03:43:47 EST


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.

Either way semantics are right so:
Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>

Yours,
Linus Walleij