linux-rockchip.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Caesar Wang <wxt-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Cc: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>,
	linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Eduardo Valentin
	<edubezval-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Zhang Rui <rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCH v4 06/10] thermal: rockchip: consistently use int for temperatures
Date: Wed, 2 Dec 2015 10:38:51 -0800	[thread overview]
Message-ID: <20151202183851.GA91131@google.com> (raw)
In-Reply-To: <1447044542-30859-7-git-send-email-wxt-TNX95d0MmH7DzftRWevZcw@public.gmane.org>

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 <wxt-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> 
> ---
> 
> 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

  parent reply	other threads:[~2015-12-02 18:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09  4:48 [PATCH v4 00/10] Better compatible for the rockchip thermal and support RK3368 SoCs Caesar Wang
     [not found] ` <1447044542-30859-1-git-send-email-wxt-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2015-11-09  4:48   ` [PATCH v4 01/10] dt-bindings: rockchip-thermal: Support the RK3368 SoCs compatible Caesar Wang
2015-11-09  4:48   ` [PATCH v4 02/10] thermal: rockchip: better to compatible the driver for different SoCs Caesar Wang
2015-11-09  4:48   ` [PATCH v4 03/10] thermal: rockchip: trivial: fix typo in commit Caesar Wang
2015-11-09  4:48   ` [PATCH v4 04/10] thermal: rockchip: improve the conversion function Caesar Wang
2015-11-09  4:49   ` [PATCH v4 08/10] arm64: dts: Add the thermal data found on RK3368 Caesar Wang
2015-11-09  4:49   ` [PATCH v4 09/10] arm64: dts: Add main Thermal info to rk3368.dtsi Caesar Wang
     [not found]     ` <1447044542-30859-10-git-send-email-wxt-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-02-09  8:30       ` Heiko Stuebner
2016-02-15  3:36         ` Caesar Wang
2015-11-09  4:48 ` [PATCH v4 05/10] thermal: rockchip: Add the sort mode for adc value increment or decrement Caesar Wang
2015-11-09  4:48 ` [PATCH v4 06/10] thermal: rockchip: consistently use int for temperatures Caesar Wang
     [not found]   ` <1447044542-30859-7-git-send-email-wxt-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2015-12-02 18:38     ` Brian Norris [this message]
     [not found]       ` <565F8FFE.3080807@rock-chips.com>
     [not found]         ` <565F8FFE.3080807-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2015-12-03  0:49           ` Brian Norris
2015-12-03  1:16             ` Caesar Wang
2015-11-09  4:48 ` [PATCH v4 07/10] thermal: rockchip: Support the RK3368 SoCs in thermal driver Caesar Wang
2015-11-09  4:49 ` [PATCH v4 10/10] arm64: dts: Enable the Thermal on R88 board Caesar Wang
2015-11-12 18:29 ` [PATCH v4 00/10] Better compatible for the rockchip thermal and support RK3368 SoCs Eduardo Valentin
2015-11-12 18:31   ` Eduardo Valentin
     [not found]     ` <20151112183119.GA5289-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2015-11-21 16:41       ` Heiko Stuebner
2015-11-12 22:14   ` Heiko Stuebner
2015-11-14  6:31     ` Caesar Wang
     [not found]   ` <20151112182950.GB4361-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2015-11-14  6:30     ` Caesar Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151202183851.GA91131@google.com \
    --to=computersforpeace-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=edubezval-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=wxt-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).