thermal: helpers: Check return value of get_temp
PATCH 1/2 thermal: helpers: Check return value of get_temp
Check the return value of get_temp, which can fail. If it does, then unlock and return the error code.
Signed-off-by Rhyland Klein <[email protected]>
--- drivers/thermal/thermal_helpers.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/thermal/thermal_helpers.c +4 -0
@@ -90,6 +90,10 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)mutex_lock (&tz->lock); ret = tz->ops->get_temp (tz, temp); +if (!ret) { +mutex_unlock (&tz->lock); + goto exit; + }if (IS_ENABLED (CONFIG_THERMAL_EMULATION ) && tz->emul_temperature) {for (count =0 ; count < tz->trips; count++) {
Signature · 1 line
1.9.1