Commit 9c6d5551 authored by Armin Wolf's avatar Armin Wolf Committed by Guenter Roeck

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: default avatarArmin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20211211184449.18211-1-W_Armin@gmx.deSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent c2fe0f63
...@@ -120,6 +120,8 @@ static int rpi_hwmon_probe(struct platform_device *pdev) ...@@ -120,6 +120,8 @@ static int rpi_hwmon_probe(struct platform_device *pdev)
data, data,
&rpi_chip_info, &rpi_chip_info,
NULL); NULL);
if (IS_ERR(data->hwmon_dev))
return PTR_ERR(data->hwmon_dev);
ret = devm_delayed_work_autocancel(dev, &data->get_values_poll_work, ret = devm_delayed_work_autocancel(dev, &data->get_values_poll_work,
get_values_poll); get_values_poll);
...@@ -127,10 +129,9 @@ static int rpi_hwmon_probe(struct platform_device *pdev) ...@@ -127,10 +129,9 @@ static int rpi_hwmon_probe(struct platform_device *pdev)
return ret; return ret;
platform_set_drvdata(pdev, data); 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 = { static struct platform_driver rpi_hwmon_driver = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment