diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2015-12-14 20:17:40 -0500 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2016-01-06 21:06:38 -0500 |
commit | a1ade5653804b8eb9d14c5ba964da6d5c2f4cd30 (patch) | |
tree | baf11e7afe84c60db03f74dc7740a31927525fc6 | |
parent | ca1e4558fcca68a5ac2a4e0f7834f788f9f4ac8f (diff) |
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>
-rw-r--r-- | drivers/thermal/rcar_thermal.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 96707a6abd7f..b012d900c3f2 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c | |||
@@ -75,12 +75,6 @@ struct rcar_thermal_priv { | |||
75 | #define rcar_has_irq_support(priv) ((priv)->common->base) | 75 | #define rcar_has_irq_support(priv) ((priv)->common->base) |
76 | #define rcar_id_to_shift(priv) ((priv)->id * 8) | 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 | static const struct of_device_id rcar_thermal_dt_ids[] = { | 78 | static const struct of_device_id rcar_thermal_dt_ids[] = { |
85 | { .compatible = "renesas,rcar-thermal", }, | 79 | { .compatible = "renesas,rcar-thermal", }, |
86 | {}, | 80 | {}, |
@@ -209,9 +203,11 @@ err_out_unlock: | |||
209 | static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp) | 203 | static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp) |
210 | { | 204 | { |
211 | struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone); | 205 | struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone); |
206 | int ret; | ||
212 | 207 | ||
213 | if (!rcar_has_irq_support(priv) || rcar_force_update_temp(priv)) | 208 | ret = rcar_thermal_update_temp(priv); |
214 | rcar_thermal_update_temp(priv); | 209 | if (ret < 0) |
210 | return ret; | ||
215 | 211 | ||
216 | mutex_lock(&priv->lock); | 212 | mutex_lock(&priv->lock); |
217 | *temp = MCELSIUS((priv->ctemp * 5) - 65); | 213 | *temp = MCELSIUS((priv->ctemp * 5) - 65); |
@@ -305,11 +301,15 @@ static void rcar_thermal_work(struct work_struct *work) | |||
305 | { | 301 | { |
306 | struct rcar_thermal_priv *priv; | 302 | struct rcar_thermal_priv *priv; |
307 | int cctemp, nctemp; | 303 | int cctemp, nctemp; |
304 | int ret; | ||
308 | 305 | ||
309 | priv = container_of(work, struct rcar_thermal_priv, work.work); | 306 | priv = container_of(work, struct rcar_thermal_priv, work.work); |
310 | 307 | ||
311 | rcar_thermal_get_temp(priv->zone, &cctemp); | 308 | rcar_thermal_get_temp(priv->zone, &cctemp); |
312 | rcar_thermal_update_temp(priv); | 309 | ret = rcar_thermal_update_temp(priv); |
310 | if (ret < 0) | ||
311 | return; | ||
312 | |||
313 | rcar_thermal_irq_enable(priv); | 313 | rcar_thermal_irq_enable(priv); |
314 | 314 | ||
315 | rcar_thermal_get_temp(priv->zone, &nctemp); | 315 | rcar_thermal_get_temp(priv->zone, &nctemp); |
@@ -447,7 +447,9 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
447 | mutex_init(&priv->lock); | 447 | mutex_init(&priv->lock); |
448 | INIT_LIST_HEAD(&priv->list); | 448 | INIT_LIST_HEAD(&priv->list); |
449 | INIT_DELAYED_WORK(&priv->work, rcar_thermal_work); | 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 | priv->zone = thermal_zone_device_register("rcar_thermal", | 454 | priv->zone = thermal_zone_device_register("rcar_thermal", |
453 | 1, 0, priv, | 455 | 1, 0, priv, |