summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorArmin Wolf <W_Armin@gmx.de>2021-12-11 19:44:49 +0100
committerGuenter Roeck <linux@roeck-us.net>2021-12-26 15:02:06 -0800
commit9c6d555187f504b880ca506b0b2d0edbdb5d2d5f (patch)
tree4a40ee5d5fca6c58195a46b08ecad052b0b86f0a /drivers/hwmon
parentc2fe0f63cafe3fc3adbd0aff6f1758b504ee3cdb (diff)
downloadlinux-9c6d555187f504b880ca506b0b2d0edbdb5d2d5f.tar.gz
linux-9c6d555187f504b880ca506b0b2d0edbdb5d2d5f.tar.bz2
linux-9c6d555187f504b880ca506b0b2d0edbdb5d2d5f.zip
hwmon: (raspberrypi) Exit immediately in case of error in init
Exit immediately if devm_hwmon_device_register_with_info() fails since registering a delayed work whould be useless in such a case anyway. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20211211184449.18211-1-W_Armin@gmx.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/raspberrypi-hwmon.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/hwmon/raspberrypi-hwmon.c b/drivers/hwmon/raspberrypi-hwmon.c
index 573f53d52912..1650d3b4c26e 100644
--- a/drivers/hwmon/raspberrypi-hwmon.c
+++ b/drivers/hwmon/raspberrypi-hwmon.c
@@ -120,6 +120,8 @@ static int rpi_hwmon_probe(struct platform_device *pdev)
data,
&rpi_chip_info,
NULL);
+ if (IS_ERR(data->hwmon_dev))
+ return PTR_ERR(data->hwmon_dev);
ret = devm_delayed_work_autocancel(dev, &data->get_values_poll_work,
get_values_poll);
@@ -127,10 +129,9 @@ static int rpi_hwmon_probe(struct platform_device *pdev)
return ret;
platform_set_drvdata(pdev, data);
- if (!PTR_ERR_OR_ZERO(data->hwmon_dev))
- schedule_delayed_work(&data->get_values_poll_work, 2 * HZ);
+ schedule_delayed_work(&data->get_values_poll_work, 2 * HZ);
- return PTR_ERR_OR_ZERO(data->hwmon_dev);
+ return 0;
}
static struct platform_driver rpi_hwmon_driver = {