From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Antoniu Miclaus <antoniu.miclaus@analog.com>
Cc: "Linus Walleij" <linusw@kernel.org>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] iio: gyro: mpu3050-core: fix pm_runtime error handling
Date: Mon, 9 Feb 2026 15:34:53 +0200 [thread overview]
Message-ID: <aYnifcPT5SL7blZT@smile.fi.intel.com> (raw)
In-Reply-To: <0309164453650011ec4d72276c8386edf1bbb88d.1770636034.git.antoniu.miclaus@analog.com>
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
next prev parent reply other threads:[~2026-02-09 13:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-09 11:33 [PATCH v3 0/2] iio: gyro: mpu3050: fix pm_runtime error handling Antoniu Miclaus
2026-02-09 12:02 ` Antoniu Miclaus
2026-02-09 12:02 ` [PATCH v3 1/2] iio: gyro: mpu3050-i2c: " Antoniu Miclaus
2026-02-09 12:02 ` [PATCH v3 2/2] iio: gyro: mpu3050-core: " Antoniu Miclaus
2026-02-09 13:34 ` Andy Shevchenko [this message]
2026-02-09 14:27 ` Nuno Sá
2026-02-09 12:13 ` [PATCH v3 0/2] iio: gyro: mpu3050: " Miclaus, Antoniu
2026-02-09 13:32 ` Andy Shevchenko
2026-02-09 13:39 ` Miclaus, Antoniu
2026-02-09 13:54 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aYnifcPT5SL7blZT@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=antoniu.miclaus@analog.com \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox