[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aYnifcPT5SL7blZT@smile.fi.intel.com>
Date: Mon, 9 Feb 2026 15:34:53 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Antoniu Miclaus <antoniu.miclaus@...log.com>
Cc: Linus Walleij <linusw@...nel.org>, Jonathan Cameron <jic23@...nel.org>,
David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/2] iio: gyro: mpu3050-core: fix pm_runtime error
handling
On Mon, Feb 09, 2026 at 02:02:16PM +0200, Antoniu Miclaus wrote:
> pm_runtime_get_sync() does not check its return value, allowing the
> driver to access hardware that may fail to resume. Use
Try to make lines more filled, this can be achieved by moving "the":
pm_runtime_get_sync() does not check its return value, allowing
the driver to access hardware that may fail to resume. Use
> pm_runtime_resume_and_get() which propagates errors and avoids
> incrementing the usage count on failure.
>
> In preenable, add pm_runtime_put_autosuspend() on set_8khz_samplerate()
> failure since postdisable does not run when preenable fails.
...
> static int mpu3050_buffer_preenable(struct iio_dev *indio_dev)
> {
> struct mpu3050 *mpu3050 = iio_priv(indio_dev);
> + int ret;
>
> - pm_runtime_get_sync(mpu3050->dev);
> + ret = pm_runtime_resume_and_get(mpu3050->dev);
> + if (ret)
> + return ret;
>
> /* Unless we have OUR trigger active, run at full speed */
> - if (!mpu3050->hw_irq_trigger)
> - return mpu3050_set_8khz_samplerate(mpu3050);
> + if (!mpu3050->hw_irq_trigger) {
> + ret = mpu3050_set_8khz_samplerate(mpu3050);
> + if (ret)
> + pm_runtime_put_autosuspend(mpu3050->dev);
> + return ret;
> + }
>
> return 0;
These 4 LoCs can be replaced with
return ret;
> }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists