From: Joshua Crofts <joshua.crofts1@gmail.com>
To: "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>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Joshua Crofts <joshua.crofts1@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH v3 1/2] iio: gyro: mpu3050: fail probe() on trigger registration failure
Date: Sat, 17 Oct 2026 07:19:20 +0200 [thread overview]
Message-ID: <20261017-mpu3050-fix-v3-1-d6f29f335a2b@gmail.com> (raw)
In-Reply-To: <20261017-mpu3050-fix-v3-0-d6f29f335a2b@gmail.com>
The current implementation lets mpu3050_common_probe() continue on trigger
registration failure, causing the device to operate in an odd polling mode
and making resource management harder.
Jump to the error handling logic if the trigger failed to register.
Suggested-by: Nuno Sá <nuno.sa@analog.com>
Fixes: 3904b28efb2c ("iio: gyro: Add driver for the MPU-3050 gyroscope")
Cc: <stable@vger.kernel.org>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
---
drivers/iio/gyro/mpu3050-core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c
index 07c0f9011c63..879caf3b729c 100644
--- a/drivers/iio/gyro/mpu3050-core.c
+++ b/drivers/iio/gyro/mpu3050-core.c
@@ -1231,8 +1231,10 @@ int mpu3050_common_probe(struct device *dev,
/* Check if we have an assigned IRQ to use as trigger */
if (irq) {
ret = mpu3050_trigger_probe(indio_dev, irq);
- if (ret)
+ if (ret) {
dev_err(dev, "failed to register trigger\n");
+ goto err_cleanup_buffer;
+ }
}
/* Enable runtime PM */
@@ -1262,6 +1264,7 @@ int mpu3050_common_probe(struct device *dev,
pm_runtime_disable(dev);
if (irq)
free_irq(mpu3050->irq, mpu3050->trig);
+err_cleanup_buffer:
iio_triggered_buffer_cleanup(indio_dev);
err_power_down:
mpu3050_power_down(mpu3050);
--
2.56.0
next prev parent reply other threads:[~2026-10-17 5:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-17 5:19 [PATCH v3 0/2] iio: gyro: mpu3050: add missing trigger cleanup Joshua Crofts
2026-10-17 5:19 ` Joshua Crofts [this message]
2026-10-17 5:19 ` [PATCH v3 2/2] iio: gyro: mpu3050: add missing trigger cleanup on remove() Joshua Crofts
2026-10-17 18:21 ` [PATCH v3 0/2] iio: gyro: mpu3050: add missing trigger cleanup Jonathan Cameron
2026-10-17 20:20 ` Joshua Crofts
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=20261017-mpu3050-fix-v3-1-d6f29f335a2b@gmail.com \
--to=joshua.crofts1@gmail.com \
--cc=andy@kernel.org \
--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 \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®