summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorClark Wang <xiaoning.wang@nxp.com>2019-09-06 20:22:06 +0800
committerDong Aisheng <aisheng.dong@nxp.com>2019-11-25 15:44:32 +0800
commit8c4d12b5afa8fa523330e5511b7096a2fafc15de (patch)
tree02f9a9524812597062718e11ead1bd9bf683b2d5 /drivers/hwmon
parentaf3730f2dc73964f6867e53ed66e9e1f436a9f60 (diff)
hwmon: mag3110: Add regulator_disable to avoid WARN_ON
In probe function, if probe fails, the enabled regulator will cause a WARN_ON. Add regulator_diable when error occurs in probe function. Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/mag3110.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/hwmon/mag3110.c b/drivers/hwmon/mag3110.c
index c8ddc8287d38..2e41265659f0 100644
--- a/drivers/hwmon/mag3110.c
+++ b/drivers/hwmon/mag3110.c
@@ -544,6 +544,11 @@ error_rm_poll_dev:
error_free_poll_dev:
input_free_polled_device(data->poll_dev);
error_rm_hwmon_dev:
+ if (!IS_ERR(vdd))
+ regulator_disable(vdd);
+ if (!IS_ERR(vdd_io))
+ regulator_disable(vdd_io);
+
hwmon_device_unregister(data->hwmon_dev);
kfree(data);