All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-pm@vger.kernel.org, Doug Berger <opendmb@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>
Subject: Re: [bug report] thermal: add brcmstb AVS TMON driver
Date: Wed, 6 Sep 2017 10:00:21 -0700	[thread overview]
Message-ID: <20170906170021.GA119185@google.com> (raw)
In-Reply-To: <20170906071522.7wyvtyznp2mdqmd7@mwanda>

On Wed, Sep 06, 2017 at 11:22:42AM +0300, Dan Carpenter wrote:
> Hello Brian Norris,

Hi Dan! Or Dan's robots.

> The patch 1e21c74eda83: "thermal: add brcmstb AVS TMON driver" from

I'll blame Doug or Florian :)

Actually, I'm pretty sure 'low' and 'high' were 'unsigned long' in the
tree where I first wrote this driver (before 'set_trips' was even merged
upstream). We can probably simplify this now.

But I'll leave that to Doug.

Brian

> Aug 9, 2017, leads to the following static checker warning:
> 
> 	drivers/thermal/broadcom/brcmstb_thermal.c:281 brcmstb_set_trips()
> 	warn: impossible condition '(low > ((~0 >> 1))) => (s32min-s32max > s32max)'
> 
> 	drivers/thermal/broadcom/brcmstb_thermal.c:290 brcmstb_set_trips()
> 	warn: impossible condition '(high > ((~0 >> 1))) => (s32min-s32max > s32max)'
> 
> drivers/thermal/broadcom/brcmstb_thermal.c
>    274  static int brcmstb_set_trips(void *data, int low, int high)
>    275  {
>    276          struct brcmstb_thermal_priv *priv = data;
>    277  
>    278          dev_dbg(priv->dev, "set trips %d <--> %d\n", low, high);
>    279  
>    280          if (low) {
>    281                  if (low > INT_MAX)
>                             ^^^^^^^^^^^^^
> Never true
> 
>    282                          low = INT_MAX;
>    283                  avs_tmon_set_trip_temp(priv, TMON_TRIP_TYPE_LOW, low);
>    284                  avs_tmon_trip_enable(priv, TMON_TRIP_TYPE_LOW, 1);
>    285          } else {
>    286                  avs_tmon_trip_enable(priv, TMON_TRIP_TYPE_LOW, 0);
>    287          }
>    288  
>    289          if (high < ULONG_MAX) {
>                     ^^^^^^^^^^^^^^^^
> Always true
> 
>    290                  if (high > INT_MAX)
>                             ^^^^^^^^^^^^^^
> Never true
> 
>    291                          high = INT_MAX;
>    292                  avs_tmon_set_trip_temp(priv, TMON_TRIP_TYPE_HIGH, high);
>    293                  avs_tmon_trip_enable(priv, TMON_TRIP_TYPE_HIGH, 1);
>    294          } else {
>    295                  avs_tmon_trip_enable(priv, TMON_TRIP_TYPE_HIGH, 0);
>    296          }
>    297  
>    298          return 0;
>    299  }
> 
> 
> regards,
> dan carpenter

  reply	other threads:[~2017-09-06 17:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-06  8:22 [bug report] thermal: add brcmstb AVS TMON driver Dan Carpenter
2017-09-06 17:00 ` Brian Norris [this message]
2017-09-06 18:08   ` Florian Fainelli
2017-09-06 18:37     ` Brian Norris
2017-09-06 19:33       ` Doug Berger
2017-09-06 19:46         ` Markus Mayer
2017-09-14 23:19           ` [PATCH] thermal: brcmstb: disable trip points properly when needed Markus Mayer
2017-09-14 23:19             ` Markus Mayer
2017-09-14 23:25             ` Markus Mayer
2017-09-14 23:25               ` Markus Mayer

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=20170906170021.GA119185@google.com \
    --to=computersforpeace@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=f.fainelli@gmail.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=opendmb@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.