Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] iio: gyro: mpu3050: Fix the error handling in mpu3050_power_up()
@ 2022-05-10  9:24 Zheyu Ma
  2022-05-12 22:08 ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Zheyu Ma @ 2022-05-10  9:24 UTC (permalink / raw)
  To: linus.walleij, jic23, lars; +Cc: linux-iio, Zheyu Ma

The driver should disable regulators when fails at regmap_update_bits().

Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
---
 drivers/iio/gyro/mpu3050-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c
index 4f19dc7ffe57..5908a96ca8af 100644
--- a/drivers/iio/gyro/mpu3050-core.c
+++ b/drivers/iio/gyro/mpu3050-core.c
@@ -875,6 +875,7 @@ static int mpu3050_power_up(struct mpu3050 *mpu3050)
 	ret = regmap_update_bits(mpu3050->map, MPU3050_PWR_MGM,
 				 MPU3050_PWR_MGM_SLEEP, 0);
 	if (ret) {
+		regulator_bulk_disable(ARRAY_SIZE(mpu3050->regs), mpu3050->regs);
 		dev_err(mpu3050->dev, "error setting power mode\n");
 		return ret;
 	}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: gyro: mpu3050: Fix the error handling in mpu3050_power_up()
  2022-05-10  9:24 [PATCH] iio: gyro: mpu3050: Fix the error handling in mpu3050_power_up() Zheyu Ma
@ 2022-05-12 22:08 ` Linus Walleij
  2022-05-14 15:58   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2022-05-12 22:08 UTC (permalink / raw)
  To: Zheyu Ma; +Cc: jic23, lars, linux-iio

On Tue, May 10, 2022 at 11:24 AM Zheyu Ma <zheyuma97@gmail.com> wrote:

> The driver should disable regulators when fails at regmap_update_bits().
>
> Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>

Looks correct!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours.
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: gyro: mpu3050: Fix the error handling in mpu3050_power_up()
  2022-05-12 22:08 ` Linus Walleij
@ 2022-05-14 15:58   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2022-05-14 15:58 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Zheyu Ma, lars, linux-iio

On Fri, 13 May 2022 00:08:37 +0200
Linus Walleij <linus.walleij@linaro.org> wrote:

> On Tue, May 10, 2022 at 11:24 AM Zheyu Ma <zheyuma97@gmail.com> wrote:
> 
> > The driver should disable regulators when fails at regmap_update_bits().
> >
> > Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>  
> 
> Looks correct!
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
I'm not going to rush this one in as

Applied to the fixes-togreg branch of iio.git and marked for stable
(I was a bit borderline in deciding on stable marking but meh, it's safe
enough as fixes go and real issue, even if one we are unlikely to hit)

Thanks,

Jonathan

> 
> Yours.
> Linus Walleij


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-14 15:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-10  9:24 [PATCH] iio: gyro: mpu3050: Fix the error handling in mpu3050_power_up() Zheyu Ma
2022-05-12 22:08 ` Linus Walleij
2022-05-14 15:58   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox