Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

thermal: rcar: check every rcar_thermal_update_temp() return value

Every rcar_thermal_update_temp() return value will be checked.

And also, rcar_thermal_get_temp() always call
rcar_thermal_update_temp() by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>

authored by

Kuninori Morimoto and committed by
Eduardo Valentin
a1ade565 ca1e4558

+12 -10
+12 -10
drivers/thermal/rcar_thermal.c
··· 75 75 #define rcar_has_irq_support(priv) ((priv)->common->base) 76 76 #define rcar_id_to_shift(priv) ((priv)->id * 8) 77 77 78 - #ifdef DEBUG 79 - # define rcar_force_update_temp(priv) 1 80 - #else 81 - # define rcar_force_update_temp(priv) 0 82 - #endif 83 - 84 78 static const struct of_device_id rcar_thermal_dt_ids[] = { 85 79 { .compatible = "renesas,rcar-thermal", }, 86 80 {}, ··· 203 209 static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp) 204 210 { 205 211 struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone); 212 + int ret; 206 213 207 - if (!rcar_has_irq_support(priv) || rcar_force_update_temp(priv)) 208 - rcar_thermal_update_temp(priv); 214 + ret = rcar_thermal_update_temp(priv); 215 + if (ret < 0) 216 + return ret; 209 217 210 218 mutex_lock(&priv->lock); 211 219 *temp = MCELSIUS((priv->ctemp * 5) - 65); ··· 301 305 { 302 306 struct rcar_thermal_priv *priv; 303 307 int cctemp, nctemp; 308 + int ret; 304 309 305 310 priv = container_of(work, struct rcar_thermal_priv, work.work); 306 311 307 312 rcar_thermal_get_temp(priv->zone, &cctemp); 308 - rcar_thermal_update_temp(priv); 313 + ret = rcar_thermal_update_temp(priv); 314 + if (ret < 0) 315 + return; 316 + 309 317 rcar_thermal_irq_enable(priv); 310 318 311 319 rcar_thermal_get_temp(priv->zone, &nctemp); ··· 447 447 mutex_init(&priv->lock); 448 448 INIT_LIST_HEAD(&priv->list); 449 449 INIT_DELAYED_WORK(&priv->work, rcar_thermal_work); 450 - rcar_thermal_update_temp(priv); 450 + ret = rcar_thermal_update_temp(priv); 451 + if (ret < 0) 452 + goto error_unregister; 451 453 452 454 priv->zone = thermal_zone_device_register("rcar_thermal", 453 455 1, 0, priv,