Skip to content

Commit 3a26787

Browse files
ZheyuMajic23
authored andcommitted
iio: magnetometer: ak8975: Fix the error handling in ak8975_power_on()
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 108e4d4 commit 3a26787

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/iio/magnetometer/ak8975.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ static int ak8975_power_on(const struct ak8975_data *data)
416416
if (ret) {
417417
dev_warn(&data->client->dev,
418418
"Failed to enable specified Vid supply\n");
419+
regulator_disable(data->vdd);
419420
return ret;
420421
}
421422

0 commit comments

Comments
 (0)