Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759386AbbLBSqW (ORCPT ); Wed, 2 Dec 2015 13:46:22 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:33142 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756662AbbLBSqU (ORCPT ); Wed, 2 Dec 2015 13:46:20 -0500 Date: Wed, 2 Dec 2015 10:38:51 -0800 From: Brian Norris To: Caesar Wang Cc: Heiko Stuebner , Eduardo Valentin , lkp@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Zhang Rui , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v4 06/10] thermal: rockchip: consistently use int for temperatures Message-ID: <20151202183851.GA91131@google.com> References: <1447044542-30859-1-git-send-email-wxt@rock-chips.com> <1447044542-30859-7-git-send-email-wxt@rock-chips.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1447044542-30859-7-git-send-email-wxt@rock-chips.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: 2293 Lines: 78 Hi Caesar, On Mon, Nov 09, 2015 at 12:48:58PM +0800, Caesar Wang wrote: > As Temperature is currently represented as int not long in the thermal > framework since use int intead of unsigned long/long to represent > temperature to avoid bogus overheat detection when negative temperature > reported. > > Signed-off-by: Caesar Wang > > --- > > Changes in v4: > - fix the warning from the print message. > > Changes in v3: > - As the Patch v2 comments, Add a new patch to fix it. > > Changes in v2: None > Changes in v1: None > > drivers/thermal/rockchip_thermal.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c > index 7c5b784..73d47f8 100644 > --- a/drivers/thermal/rockchip_thermal.c > +++ b/drivers/thermal/rockchip_thermal.c > @@ -88,7 +88,7 @@ struct rockchip_tsadc_chip { > int chn_num; > > /* The hardware-controlled tshut property */ > - long tshut_temp; > + int tshut_temp; > enum tshut_mode tshut_mode; > enum tshut_polarity tshut_polarity; > ... > @@ -126,7 +126,7 @@ struct rockchip_thermal_data { > > void __iomem *regs; > > - long tshut_temp; > + int tshut_temp; FYI, this change is triggering a new warning in Coverity, below: > enum tshut_mode tshut_mode; > enum tshut_polarity tshut_polarity; > }; ... > @@ -477,7 +477,7 @@ static int rockchip_configure_from_dt(struct device *dev, > } > > if (thermal->tshut_temp > INT_MAX) { CID 1341498: Integer handling issues (CONSTANT_EXPRESSION_RESULT) "thermal->tshut_temp > 2147483647 /* (int)(~0U >> 1) */" is always false regardless of the values of its operands. This occurs as the logical operand of if. I don't think this condition is even useful any more, so maybe we should just kill the 'if' block. > - dev_err(dev, "Invalid tshut temperature specified: %ld\n", > + dev_err(dev, "Invalid tshut temperature specified: %d\n", > thermal->tshut_temp); > return -ERANGE; > } Brian -- 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/