summaryrefslogtreecommitdiffstats
path: root/drivers/thermal
diff options
context:
space:
mode:
authorPeter Mamonov <pmamonov@gmail.com>2019-08-27 17:39:52 +0300
committerDaniel Lezcano <daniel.lezcano@linaro.org>2020-01-27 15:39:52 +0100
commit370f995d587852dc8da4ce5687acae8be61d7529 (patch)
tree52131a5af3b21a2d41d1e29e455c433fe36dc787 /drivers/thermal
parent0f510a2457cbbba18a98492bab1bf540be57ebd1 (diff)
downloadlinux-370f995d587852dc8da4ce5687acae8be61d7529.tar.bz2
thermal: of: Make thermal_zone_of_sensor_register return -ENODEV if a sensor OF node is missing
When devm_thermal_zone_of_sensor_register() is called from hwmon_thermal_add_sensor() it is possible that the relevant sensor is missing an OF node. In this case thermal_zone_of_sensor_register() returns -EINVAL which causes hwmon_thermal_add_sensor() to fail as well. This patch changes relevant return code of thermal_zone_of_sensor_register() to -ENODEV, which is tolerated by hwmon_thermal_add_sensor(). Here is a particular case of such behaviour: the Marvell ethernet PHYs driver registers hwmon device for the built-in temperature sensor (see drivers/net/phy/marvell.c). Since the sensor doesn't have associated OF node devm_hwmon_device_register() returns error which ultimately causes failure of the PHY driver's probe function. Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20190827143952.19591-1-pmamonov@gmail.com
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/of-thermal.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
index 3f66e35d6ecf..ef0baa954ff0 100644
--- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c
@@ -493,7 +493,7 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id, void *data,
if (!dev || !dev->of_node) {
of_node_put(np);
- return ERR_PTR(-EINVAL);
+ return ERR_PTR(-ENODEV);
}
sensor_np = of_node_get(dev->of_node);