Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932588AbbLNVU2 (ORCPT ); Mon, 14 Dec 2015 16:20:28 -0500 Received: from mail-pa0-f47.google.com ([209.85.220.47]:32968 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932365AbbLNVUZ (ORCPT ); Mon, 14 Dec 2015 16:20:25 -0500 Date: Mon, 14 Dec 2015 13:20:22 -0800 From: Eduardo Valentin To: Kuninori Morimoto Cc: Simon , Zhang Rui , Geert Uytterhoeven , Magnus , linux-sh@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, "devicetree@vger.kernel.org" Subject: Re: [PATCH 4/8 v4] thermal: rcar: retern error rcar_thermal_get_temp() if no ctemp update Message-ID: <20151214212021.GA10992@localhost.localdomain> References: <87vb895x9d.wl%kuninori.morimoto.gx@renesas.com> <87poyh5x69.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87poyh5x69.wl%kuninori.morimoto.gx@renesas.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1707 Lines: 46 On Tue, Dec 08, 2015 at 05:28:13AM +0000, Kuninori Morimoto wrote: > From: Kuninori Morimoto > > Current rcar_thermal_get_temp() returns latest temperature, but it might > not be updated if some HW issue happened. This means user might get > wrong temperature. This patch solved this issue. > > Signed-off-by: Kuninori Morimoto > --- > v3 -> v4 > > - "happend" -> "happened" > > drivers/thermal/rcar_thermal.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c > index 67b5216..40c3ba5 100644 > --- 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? BR, -- 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/