iio: gyro: mpu3050: Fix the error handling in mpu3050_power_up()
authorZheyu Ma <zheyuma97@gmail.com>
Tue, 10 May 2022 09:24:31 +0000 (17:24 +0800)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 19 Jun 2022 16:22:48 +0000 (17:22 +0100)
The driver should disable regulators when fails at regmap_update_bits().

Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220510092431.1711284-1-zheyuma97@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/gyro/mpu3050-core.c

index ea387efab62d24096b1b484ccca4dfc41ec3ed40..f4c2f4cb483493bd59db1f4e0f26138859940456 100644 (file)
@@ -874,6 +874,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;
        }