Commit 45b8850b authored by Dan Carpenter's avatar Dan Carpenter Committed by Daniel Lezcano

thermal/of: Fix error code in of_thermal_zone_find()

Currently, if we cannot find the correct thermal zone then this error
path returns NULL and it would lead to an Oops in the caller.  Return
ERR_PTR(-EINVAL) instead.

Fixes: 3bd52ac87347 ("thermal/of: Rework the thermal device tree initialization")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YvDzovkMCQecPDjz@kiliSigned-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
parent 3fd6d6e2
...@@ -1102,6 +1102,7 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int ...@@ -1102,6 +1102,7 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int
} }
} }
} }
tz = ERR_PTR(-EINVAL);
out: out:
of_node_put(np); of_node_put(np);
return tz; return tz;
......
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