From patchwork Tue Dec 15 01:18:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 7850361 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 062E0BEEE1 for ; Tue, 15 Dec 2015 01:18:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 33DE820374 for ; Tue, 15 Dec 2015 01:18:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4428620361 for ; Tue, 15 Dec 2015 01:18:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753686AbbLOBSV (ORCPT ); Mon, 14 Dec 2015 20:18:21 -0500 Received: from relmlor2.renesas.com ([210.160.252.172]:62509 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753671AbbLOBSR (ORCPT ); Mon, 14 Dec 2015 20:18:17 -0500 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie1.idc.renesas.com with ESMTP; 15 Dec 2015 10:18:16 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 30BA349E99; Tue, 15 Dec 2015 10:18:16 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id 2826A8002E; Tue, 15 Dec 2015 10:18:16 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id 2231C8002D; Tue, 15 Dec 2015 10:18:16 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac1.idc.renesas.com with ESMTP id LBL11207; Tue, 15 Dec 2015 10:18:16 +0900 X-IronPort-AV: E=Sophos;i="5.20,429,1444662000"; d="scan'";a="200568115" Received: from mail-pu1apc01lp0021.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.21]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 15 Dec 2015 10:18:14 +0900 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.144) by HKXPR06MB1013.apcprd06.prod.outlook.com (10.161.137.28) with Microsoft SMTP Server (TLS) id 15.1.355.16; Tue, 15 Dec 2015 01:18:13 +0000 Message-ID: <877fkgqzpt.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 4/8 v5] thermal: rcar: rcar_thermal_get_temp() return error if strange temp User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") To: Simon , Zhang Rui , Eduardo Valentin CC: Geert Uytterhoeven , Magnus , , , , "devicetree@vger.kernel.org" In-Reply-To: <87d1u8qzsy.wl%kuninori.morimoto.gx@renesas.com> References: <87d1u8qzsy.wl%kuninori.morimoto.gx@renesas.com> Date: Tue, 15 Dec 2015 01:18:13 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR06CA0022.apcprd06.prod.outlook.com (25.164.91.32) To HKXPR06MB1013.apcprd06.prod.outlook.com (25.161.137.28) X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB1013; 2:BEom2EHvqkBw47yohyFKVi49yEkATF5k/yTGmGXrlItDFvtU+NZFxWLcVgie+e15kSDsToFsku/o7g1I9zTu+NMJCWAYqBYZPUMuoDQTZoopLhSC56FtAUCLPr5Jgw1N2pkhqPJ4fyvE9Zcy5MwU5w==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p8newPLSI28suLkI6Ud8C5evzAvavWZKsr6CPaZkp6u1ikfdOZQbkwk2M3OJgPY/NEQ3tPB+DIzW/efqy1GzKStf/JkCx8vY6+HinQI/U52akFjuJ0iA7lT6PWhcdGKFbUTtrREOCuvtA7QFla0yRqpQVt9SnUR3eVW1EwgTDSXI3sK+hM6nhkF/5cvs/GopOT6IpRBeWxPEXicJ2LKZznBN3A25bC990+9eQj50a1F/QTflwYAA4gLqi59dKjtwELIr/ceGQGpAY1l4/9DsKiU/5zJ9BugQTaSb9pC3tVX5K/GzIJRADE0raiKs3WYMincw6o2u20tEHhL5V2VDfHCtxMoW3C83W3rmonBOJ tTyZw= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85106069007906); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(8121501046)(5005006)(3002001)(10201501046); SRVR:HKXPR06MB1013; BCL:0; PCL:0; RULEID:; SRVR:HKXPR06MB1013; X-Forefront-PRVS: 07915F544A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(199003)(189002)(189998001)(97736004)(5001770100001)(54356999)(53416004)(586003)(36756003)(5001960100002)(6116002)(1096002)(3846002)(23726003)(5004730100002)(81156007)(4001350100001)(229853001)(5008740100001)(33646002)(46406003)(40100003)(50986999)(66066001)(42186005)(122386002)(77096005)(50466002)(105586002)(76176999)(87976001)(106356001)(86362001)(92566002)(83506001)(101416001)(19580395003)(19580405001)(47776003)(69596002)(2950100001); DIR:OUT; SFP:1102; SCL:1; SRVR:HKXPR06MB1013; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HKXPR06MB1013; 23:Xy04o0yrgLY6TUwessdnp23HlZ9qmOJQrzKyOaIFI?= =?us-ascii?Q?9mBMSyag8/wkNht+OxT7gbWQDTwFvXBW5BfI0SXvdOYthfOYmCf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jkZa9np9JIrsmIdHY8fyF/LNpicFx9Hs+xpJjZEw5GltQI?= =?us-ascii?Q?f04nshfG5wKDdlFGBUs2VlkVkdQR07vCnKG1GzHGRTCsbnpxUQ4m7iZq5XE8?= =?us-ascii?Q?zMbkrz62tcTc9+Qp317TiHKsDuD3nzWeOkru2X1tkdDl+v553WhbG8Cd6rRi?= =?us-ascii?Q?FR0cXFqxV8=3D?= X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB1013; 5:VcDYqLI3PjB7HAOhBlERH2oyJiCxhLDjAZJhKXH8/syynardgZGfejMHl1lG6yS6fcassrJ1Lq7wfCsUW6uJEWoKC2NJfMET41B/qr5HmvlSfOK5oBSlaL0MTnX/McTbwebWwhf3JyZJEP75IEk7Hg==; 24:Jp3RS0ZQItrMzuFtkqt+mRZLLcaOEwOM8rHbXOM5GO3ZwJncRPUwIfO8ZQFiZEyrK2o3tC9LfHmN29BdJRfcW2WkZ/UfMM88XCkMIOMlkwg=; 20:Ayyuvf6MYlRVp8AStCN/rau04ypsNpXAPpoli9iDnIMmF2cMO/Jy2dWTQ/N3MNspMcqesRbModpoUcXucoAYwQew1NSfiipm1cAUkc24r4K6b0wduw8M7RKubxtwrIRWrDl1FMVhWFQB67cxI8iKd/zM0Ay7yZaDFGIwPvOC2tI= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2015 01:18:13.1853 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKXPR06MB1013 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto Signed-off-by: Kuninori Morimoto --- 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; }