summaryrefslogtreecommitdiff
path: root/drivers/thermal/thermal_of.c
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2022-08-09 11:56:27 +0300
committerDaniel Lezcano <daniel.lezcano@linaro.org>2022-08-17 15:09:37 +0300
commit9d6792df07367aab42009d2b24c62c11a5968ee3 (patch)
tree45147eda9efb6d2ae2f0e330d9fd2d6082f28831 /drivers/thermal/thermal_of.c
parent45b8850b3d3071d5ea9e19ad4a29ad5f0b5d1ec1 (diff)
downloadlinux-9d6792df07367aab42009d2b24c62c11a5968ee3.tar.xz
thermal/of: Return -ENODEV instead of -EINVAL if registration fails
The previous version of the OF code was returning -ENODEV if no thermal zones description was found or if the lookup of the sensor in the thermal zones was not found. The backend drivers are expecting this return value as an information about skipping the sensor initialization and considered as normal. Fix the return value by replacing -EINVAL by -ENODEV and remove the error message as this missing is not considered as an error. Fixes: 3bd52ac87347 ("thermal/of: Rework the thermal device tree initialization") Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Tested-by: Michael Walle <michael@walle.cc> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20220809085629.509116-2-daniel.lezcano@linaro.org
Diffstat (limited to 'drivers/thermal/thermal_of.c')
-rw-r--r--drivers/thermal/thermal_of.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index 15b342fa81d6..072e05477855 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -1062,8 +1062,8 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int
np = of_find_node_by_name(NULL, "thermal-zones");
if (!np) {
- pr_err("Unable to find thermal zones description\n");
- return ERR_PTR(-EINVAL);
+ pr_debug("No thermal zones description\n");
+ return ERR_PTR(-ENODEV);
}
/*
@@ -1102,7 +1102,7 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int
}
}
}
- tz = ERR_PTR(-EINVAL);
+ tz = ERR_PTR(-ENODEV);
out:
of_node_put(np);
return tz;
@@ -1376,7 +1376,8 @@ struct thermal_zone_device *thermal_of_zone_register(struct device_node *sensor,
np = of_thermal_zone_find(sensor, id);
if (IS_ERR(np)) {
- pr_err("Failed to find thermal zone for %pOFn id=%d\n", sensor, id);
+ if (PTR_ERR(np) != -ENODEV)
+ pr_err("Failed to find thermal zone for %pOFn id=%d\n", sensor, id);
return ERR_CAST(np);
}