[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <877fkgqzpt.wl%kuninori.morimoto.gx@renesas.com>
Date: Tue, 15 Dec 2015 01:18:13 +0000
From: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
To: Simon <horms@...ge.net.au>, Zhang Rui <rui.zhang@...el.com>,
Eduardo Valentin <edubezval@...il.com>
CC: Geert Uytterhoeven <geert@...ux-m68k.org>,
Magnus <magnus.damm@...il.com>, <linux-sh@...r.kernel.org>,
<linux-pm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>
Subject: [PATCH 4/8 v5] thermal: rcar: rcar_thermal_get_temp() return error if strange temp
From: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
---
v4 -> v5
- rcar_thermal_update_temp() has no change
- "retern" -> "return" on Subject
drivers/thermal/rcar_thermal.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index e9e4e39..30602f2 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -203,6 +203,7 @@ err_out_unlock:
static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
{
struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
+ int tmp;
int ret;
ret = rcar_thermal_update_temp(priv);
@@ -210,9 +211,18 @@ static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
return ret;
mutex_lock(&priv->lock);
- *temp = MCELSIUS((priv->ctemp * 5) - 65);
+ tmp = MCELSIUS((priv->ctemp * 5) - 65);
mutex_unlock(&priv->lock);
+ if ((tmp < MCELSIUS(-45)) || (tmp > MCELSIUS(125))) {
+ struct device *dev = rcar_priv_to_dev(priv);
+
+ dev_err(dev, "it couldn't measure temperature correctly\n");
+ return -EIO;
+ }
+
+ *temp = tmp;
+
return 0;
}
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists