summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZheyu Ma <zheyuma97@gmail.com>2022-05-10 17:24:31 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-06-29 09:04:39 +0200
commit1b3a1977dde4634ac9e576fef403929ac5467c9a (patch)
tree104f00b65e585eedf81288b7008d00e15b247d20
parentd0368d4b1e294dd7ed7e1e678e8c95c906dab338 (diff)
downloadlinux-stable-1b3a1977dde4634ac9e576fef403929ac5467c9a.tar.gz
linux-stable-1b3a1977dde4634ac9e576fef403929ac5467c9a.tar.bz2
linux-stable-1b3a1977dde4634ac9e576fef403929ac5467c9a.zip
iio: gyro: mpu3050: Fix the error handling in mpu3050_power_up()
commit b2f5ad97645e1deb5ca9bcb7090084b92cae35d2 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/iio/gyro/mpu3050-core.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c
index ea387efab62d..f4c2f4cb4834 100644
--- a/drivers/iio/gyro/mpu3050-core.c
+++ b/drivers/iio/gyro/mpu3050-core.c
@@ -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;
}