diff options
| author | Zheyu Ma <zheyuma97@gmail.com> | 2022-04-09 11:48:49 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-05-12 12:14:54 +0200 |
| commit | cddbb17f303f0087fa7dbf10de9221a392c2f056 (patch) | |
| tree | f86d976107734c67296b20bd8fd09315922dc508 /drivers | |
| parent | d6144390fe47e7755c868c361aebbd088951ac72 (diff) | |
| download | linux-cddbb17f303f0087fa7dbf10de9221a392c2f056.tar.gz linux-cddbb17f303f0087fa7dbf10de9221a392c2f056.tar.bz2 linux-cddbb17f303f0087fa7dbf10de9221a392c2f056.zip | |
iio: magnetometer: ak8975: Fix the error handling in ak8975_power_on()
commit 3a26787dacf04257a68b16315c984eb2c340bc5e upstream.
When the driver fails to enable the regulator 'vid', we will get the
following splat:
[ 79.955610] WARNING: CPU: 5 PID: 441 at drivers/regulator/core.c:2257 _regulator_put+0x3ec/0x4e0
[ 79.959641] RIP: 0010:_regulator_put+0x3ec/0x4e0
[ 79.967570] Call Trace:
[ 79.967773] <TASK>
[ 79.967951] regulator_put+0x1f/0x30
[ 79.968254] devres_release_group+0x319/0x3d0
[ 79.968608] i2c_device_probe+0x766/0x940
Fix this by disabling the 'vdd' regulator when failing to enable 'vid'
regulator.
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Link: https://lore.kernel.org/r/20220409034849.3717231-2-zheyuma97@gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/iio/magnetometer/ak8975.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c index 2a4e23e20ebc..a0787b1835e5 100644 --- a/drivers/iio/magnetometer/ak8975.c +++ b/drivers/iio/magnetometer/ak8975.c @@ -404,6 +404,7 @@ static int ak8975_power_on(const struct ak8975_data *data) if (ret) { dev_warn(&data->client->dev, "Failed to enable specified Vid supply\n"); + regulator_disable(data->vdd); return ret; } /* |
