[PATCH 6/8] i2c: nomadik: handle pm_runtime errors
Linus Walleij
linusw at kernel.org
Thu Nov 5 00:42:02 PST 2026
On Tue, Nov 3, 2026 at 9:30 AM Dmitry Guzman <Dmitry.Guzman at mobileye.com> 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 at mobileye.com>
(...)
> - 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 at kernel.org>
Yours,
Linus Walleij
More information about the linux-arm-kernel
mailing list