From patchwork Tue Dec 15 01:17:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 7850321 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 940339F1C2 for ; Tue, 15 Dec 2015 01:18:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A9AD420375 for ; Tue, 15 Dec 2015 01:18:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9BD9620357 for ; Tue, 15 Dec 2015 01:18:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933012AbbLOBRs (ORCPT ); Mon, 14 Dec 2015 20:17:48 -0500 Received: from relmlor3.renesas.com ([210.160.252.173]:51520 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932795AbbLOBRp (ORCPT ); Mon, 14 Dec 2015 20:17:45 -0500 Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie2.idc.renesas.com with ESMTP; 15 Dec 2015 10:17:44 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id 493704E1BE; Tue, 15 Dec 2015 10:17:44 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id 400608002E; Tue, 15 Dec 2015 10:17:44 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id 3826A8002D; Tue, 15 Dec 2015 10:17:44 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac1.idc.renesas.com with ESMTP id LAH11145; Tue, 15 Dec 2015 10:17:44 +0900 X-IronPort-AV: E=Sophos;i="5.20,429,1444662000"; d="scan'";a="201809380" Received: from mail-pu1apc01lp0022.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.22]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 15 Dec 2015 10:17:42 +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 SIXPR06MB1023.apcprd06.prod.outlook.com (10.160.240.28) with Microsoft SMTP Server (TLS) id 15.1.355.16; Tue, 15 Dec 2015 01:17:40 +0000 Message-ID: <87a8pcqzqq.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 2/8 v5] thermal: rcar: check every rcar_thermal_update_temp() return value 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:17:40 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: HKXPR03CA0034.apcprd03.prod.outlook.com (10.141.129.24) To SIXPR06MB1023.apcprd06.prod.outlook.com (25.160.240.28) X-Microsoft-Exchange-Diagnostics: 1; SIXPR06MB1023; 2:uIJrNzxvZ25zJa4ndpWIRQIb24t9uA9/HE3n4Kjve3tYEHZA5/pDuPkgJ2DzDF6QDWh4+q4vEbMrONrUEE4zA0JlRmiGdt7//MrrycKacSY5aGdkcSpzg/8xrKXnnc5IqPjOk5mRi3cFl31XlgmZbQ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ZSLLHPewfdzMp7ClS/TWkNoTlI0o/Oqy9ar2G7IVxWDiTkRiLRFPtLV8wgJgwJR5NaM6V3ajHHZi8KY8i++NB2nJln7EHNDqlNXJrhvknvlb8sC+3YFzL5FzVfy/6DECYkuHMLzGL67AaKDnxaXylXISEW7butZ4iHPV1IS34r1p6X/j2cEL7dEoqOs8wgtDUAjuRZVgDqB9QkTvI0SZSQQgsPu0Zr/ETmpnHAcA6aewLuXRGpwj6YtzQEFayb8sQo54Ho4bD2B55tpInkoc6Mc4qFRZFjhKYq5WUlJZbzBBKP5Zm8lUTBpilZX1Vbr+2X6lkxJgYk1oTIPRLwa59cJBjAg2o6JizcKKQMi+TQoma K3yYq8BQ6+qYbqPwK9Fqyw+L0n X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85106069007906); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001)(10201501046); SRVR:SIXPR06MB1023; BCL:0; PCL:0; RULEID:; SRVR:SIXPR06MB1023; X-Forefront-PRVS: 07915F544A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(199003)(189002)(5001770100001)(66066001)(92566002)(54356999)(46406003)(5008740100001)(36756003)(87976001)(47776003)(586003)(1096002)(6116002)(122386002)(3846002)(40100003)(23726003)(50986999)(19580395003)(105586002)(69596002)(81156007)(50466002)(106356001)(53416004)(5001960100002)(189998001)(77096005)(229853001)(2950100001)(5004730100002)(19580405001)(83506001)(76176999)(4001350100001)(42186005)(86362001)(33646002)(97736004)(101416001); DIR:OUT; SFP:1102; SCL:1; SRVR:SIXPR06MB1023; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SIXPR06MB1023; 23:JmdvPOBQ9YaoULtsBaq/pXWAeHhFeAWMP9OtgPrc1?= =?us-ascii?Q?zyoI0SSD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g5eC8xt?= =?us-ascii?Q?wRNIFpEEjJ+ZYfYkthL2If8Mt5LKmPwdNYl0Ysfu3rJUckndfRGvS7rKWacJ?= =?us-ascii?Q?jAoOwYJK5Vkz4tKW2AgjmJjsaZRRN5CQ3fBzDgwgxVFexA9dHnKY43TZf8Bv?= =?us-ascii?Q?+6OWn656trX4ih7jIcGWu3F6UC3A+Q+jv5lqI8P0AM67zayQIRxYQTYRBb5H?= =?us-ascii?Q?cBCJJHaSyA=3D?= X-Microsoft-Exchange-Diagnostics: 1; SIXPR06MB1023; 5:Zx+IygYcUEJzd2weGF4hY0wgXeziUl3STIwqn9WM8iKoiYq+drAWpoHgNCx9jcYJrWeEK1RiEvbyhBjptwygG6IjFIPIBBKp8hpzXN4AFtSWlW25WjWJ4hbbavO6LlQx8GHurtXaFhma2JsYWs2r0w==; 24:PTIAbJ3TjbtNcrvA/XcTaFvDoI56lh5TvXc7CP/h/USa3ar0NfstO+V/m8pOGmUdZKR0S/dKPOnSoXknyQTG5875b+r4/yoP/mtQbtILgPI=; 20:B6icJ4mJfeePRj1pVu4TgxZI+Beza2nT6GPQ1s+4laIXcOTKZzdWyuT4JcrCDgI/XNe/nB4BLnixzTN3C6THmolKPynn3UTLDsHCDkVjWq3uknkD5Yyda1ZTH4wWCVkYSUf/t4LuAMDMOssIlhwG2hiJXJb9cNrHw8d+EG1R1Kw= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2015 01:17:40.5593 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SIXPR06MB1023 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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=unavailable 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 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 --- v4 -> v5 - rcar_thermal_get_temp() calls rcar_thermal_update_temp() without checking rcar_has_irq_support() drivers/thermal/rcar_thermal.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index ac8d1eb..0b19743 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -75,12 +75,6 @@ struct rcar_thermal_priv { #define rcar_has_irq_support(priv) ((priv)->common->base) #define rcar_id_to_shift(priv) ((priv)->id * 8) -#ifdef DEBUG -# define rcar_force_update_temp(priv) 1 -#else -# define rcar_force_update_temp(priv) 0 -#endif - static const struct of_device_id rcar_thermal_dt_ids[] = { { .compatible = "renesas,rcar-thermal", }, {}, @@ -209,9 +203,11 @@ 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 ret; - if (!rcar_has_irq_support(priv) || rcar_force_update_temp(priv)) - rcar_thermal_update_temp(priv); + ret = rcar_thermal_update_temp(priv); + if (ret < 0) + return ret; mutex_lock(&priv->lock); *temp = MCELSIUS((priv->ctemp * 5) - 65); @@ -305,11 +301,15 @@ static void rcar_thermal_work(struct work_struct *work) { struct rcar_thermal_priv *priv; int cctemp, nctemp; + int ret; priv = container_of(work, struct rcar_thermal_priv, work.work); rcar_thermal_get_temp(priv->zone, &cctemp); - rcar_thermal_update_temp(priv); + ret = rcar_thermal_update_temp(priv); + if (ret < 0) + return; + rcar_thermal_irq_enable(priv); rcar_thermal_get_temp(priv->zone, &nctemp); @@ -427,7 +427,9 @@ static int rcar_thermal_probe(struct platform_device *pdev) mutex_init(&priv->lock); INIT_LIST_HEAD(&priv->list); INIT_DELAYED_WORK(&priv->work, rcar_thermal_work); - rcar_thermal_update_temp(priv); + ret = rcar_thermal_update_temp(priv); + if (ret < 0) + goto error_unregister; priv->zone = thermal_zone_device_register("rcar_thermal", 1, 0, priv,