Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932891AbbLNXzj (ORCPT ); Mon, 14 Dec 2015 18:55:39 -0500 Received: from relmlor3.renesas.com ([210.160.252.173]:32193 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932197AbbLNXzg (ORCPT ); Mon, 14 Dec 2015 18:55:36 -0500 X-IronPort-AV: E=Sophos;i="5.20,429,1444662000"; d="scan'";a="200562245" Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Message-ID: <87h9jkr3jo.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Eduardo Valentin CC: Simon , Zhang Rui , Geert Uytterhoeven , Magnus , , , , "devicetree@vger.kernel.org" Subject: Re: [PATCH 4/8 v4] thermal: rcar: retern error rcar_thermal_get_temp() if no ctemp update In-Reply-To: <20151214212021.GA10992@localhost.localdomain> References: <87vb895x9d.wl%kuninori.morimoto.gx@renesas.com> <87poyh5x69.wl%kuninori.morimoto.gx@renesas.com> <20151214212021.GA10992@localhost.localdomain> User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset="US-ASCII" Date: Mon, 14 Dec 2015 23:55:30 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR06CA0009.apcprd06.prod.outlook.com (25.164.91.19) To HK2PR06MB1009.apcprd06.prod.outlook.com (25.161.183.28) X-Microsoft-Exchange-Diagnostics: 1;HK2PR06MB1009;2:/P7diCw7JOY4/x4XrRDtr0ukuUryZW9+vMffaFKGexsu/wN7JE4aCvZd8wLY+pNdJZuZws/qOQPK5B5Pb14ij9VbJcyYQenbm7f+M0hFvpB9u1E+dnKPVJSSRplhC8jkUGOvkAqolQ4XbWkaN0jmCA==;3:LmjWRajlxhbFeheqX079ZMu0r9u9e2M8UCnMfC7GZBEJ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QtR7jaEtF/Gt9VU3nYwzpe9UlNyv2UggdE6V2qmELMrgBqiCYcix9eP2QMtGo4l5Yhr7UiM4X2fZC1ESM6toJ0Bhtx1CmFZ01kPycpAyyD47YIbAqeyMl6taYpV7gXQG+1V5LENeQ9K9/WQ5nZgEG1/EjwEg4CA1/TOTDvVu4u9zf79HfnDR7m5xB5XTDPzS2ZGm7VufRomOPhSiviKn1CDAgiR61ZRWYSTYBgVI3lltH5b3NL9kqi5NKkT1W6YtnUWBqC8n7g X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(520078)(3002001)(10201501046);SRVR:HK2PR06MB1009;BCL:0;PCL:0;RULEID:;SRVR:HK2PR06MB1009; X-Forefront-PRVS: 0790FB1F33 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(199003)(189002)(110136002)(54356999)(105586002)(1411001)(97736004)(23726003)(66066001)(5008740100001)(77096005)(106356001)(101416001)(47776003)(42186005)(92566002)(81156007)(69596002)(122386002)(4001350100001)(6116002)(50986999)(33646002)(40100003)(46406003)(5001960100002)(5004730100002)(189998001)(76176999)(53416004)(87976001)(36756003)(2950100001)(50466002)(86362001)(586003)(1096002)(83506001)(3846002);DIR:OUT;SFP:1102;SCL:1;SRVR:HK2PR06MB1009;H:morimoto-PC.renesas.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;HK2PR06MB1009;23:irhJIeHxlG/rg6ZD+6CwFBVGbrnAikWvqWT8hdGYo?= =?us-ascii?Q?5BYZLxP/2N1z5nIYBcUTT0iKit9TRO3TutsOP9+dmcgaULCiFWvXrBZ2KD2r?= =?us-ascii?Q?AdHt1CLjyl0skkWNYnv3bJdqNkv4HOxUQ2Kp26knaNvwZrcVSvK4FDgYtO7T?= =?us-ascii?Q?ZMzn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W0ap7i/WA?= =?us-ascii?Q?hqUtMU=3D?= X-Microsoft-Exchange-Diagnostics: 1;HK2PR06MB1009;5:dlg3MWVcZ28ftv2+eWmCEAM0+ROH8g0Ys99Ck0aVvJdN2Q8SwjD4UXbR0pIYvSIZJoiIEuE177QM0Sqt2EfZbp/W2zQwIzFA0qfcTNFG0XT+ucLDL3vTJP/N8FKJFGYbd5PBuXQMcYafYAxglMAG+w==;24:6FPUeN3MTqYjb4iw6k+8I1WzZ8QIUdU0xw2ukdaCSTyhzZaX9wNpIfE4k62wLQexKwiRPvqPBQyqmUpdGPDY/JHak0mbVeWmxjMQvyUnwMQ=;20:XxXoxlSvltv6Zew2kKjn8lkQatHspSoiXi2dpElV7jFVicbGOr08IFQW0nOwhtgmDftoCddYh0L5d4/3s5R1g3fdivC+8wlbPthduMf+52suNkJhkvIfGqwekZhgRZshbRi/UheTsEMFoaMNlT8/8gzUMjP5NAgzKUQWtt3yqvg= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2015 23:55:30.9564 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR06MB1009 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1467 Lines: 40 Hi Eduardo > > --- a/drivers/thermal/rcar_thermal.c > > +++ b/drivers/thermal/rcar_thermal.c > > @@ -199,9 +199,9 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) > > > > dev_dbg(dev, "thermal%d %d -> %d\n", priv->id, priv->ctemp, ctemp); > > > > - priv->ctemp = ctemp; > > ret = 0; > > err_out_unlock: > > + priv->ctemp = ctemp; > > mutex_unlock(&priv->lock); > > return ret; > > I believe the problem here is actually the lack of error > handling/propagation. Are you sure you want to write to parameter > in the fail path ? > > rcar_thermal_update_temp already returns error code when it fails > to read temperature. Don't you think it would make more sense to fix the > places that call rcar_thermal_update_temp to properly handle its return > value and propagate that error code when necessary? Thanks. But the logic is that priv->ctemp will be 0 in error cases, and it will be reported as dev_err() in rcar_thermal_get_current_temp() The problem was that priv->ctemp will not be updated in error case of rcar_thermal_update_temp(). but user can call get_temp (it doesn't call rcar_thermal_update_temp() if interrupt was supported). In such case, user will get old thermal. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/