Skip to contentSkip to conversation

iio: gyro: mpu3050: Fix the error handling in mpu3050_power_up()

PATCH Applied Zheyu Ma 3 participants 3 messages May 10, 2022 – May 14, 2022

Subsystems (2)
lore
Share & tools
lore

Zheyu Ma

author
#0 lore raw

PATCH 1/1 iio: gyro: mpu3050: Fix the error handling in mpu3050_power_up()

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

---
 drivers/iio/gyro/mpu3050-core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/gyro/mpu3050-core.c +1 -0
index 4f19dc7ffe57..5908a96ca8af 100644
@@ -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;
 	}
Signature · 1 line
2.25.1
maintainer Applied
#2 lore raw
Quoted 8 lines · On Fri, 13 May 2022 00:08:37 +0200 Linus Walleij <[email protected]>…
Quoted 3 lines · Zheyu Ma

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

Looks correct!

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

Quoted 3 lines

Yours.
Linus Walleij