From b4b30ffe8a34c4695239342022ff74d1b8eb1e98 Mon Sep 17 00:00:00 2001 From: Clark Wang Date: Fri, 6 Sep 2019 20:22:40 +0800 Subject: [PATCH] hwmon: mma8451: 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 --- drivers/hwmon/mxc_mma8451.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/hwmon/mxc_mma8451.c b/drivers/hwmon/mxc_mma8451.c index 9d6c53927757..3c6dbbe71bc1 100644 --- a/drivers/hwmon/mxc_mma8451.c +++ b/drivers/hwmon/mxc_mma8451.c @@ -510,6 +510,10 @@ err_register_polled_device: err_alloc_poll_device: hwmon_device_unregister(&client->dev); err_out: + if (!IS_ERR(vdd)) + regulator_disable(vdd); + if (!IS_ERR(vdd_io)) + regulator_disable(vdd_io); return result; }