Linux-PM Archive on lore.kernel.org
 help / color / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Nathan Huckleberry <nhuck@google.com>,
	miquel.raynal@bootlin.com, rui.zhang@intel.com,
	edubezval@gmail.com
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	clang-built-linux@googlegroups.com
Subject: Re: [PATCH] thermal: armada: Fix -Wshift-negative-value
Date: Fri, 14 Jun 2019 12:11:14 +0200
Message-ID: <27428324-129e-ee37-304a-0da2ed3810a0@linaro.org> (raw)
In-Reply-To: <20190613184923.245935-1-nhuck@google.com>

On 13/06/2019 20:49, Nathan Huckleberry wrote:
> Clang produces the following warning
> 
> drivers/thermal/armada_thermal.c:270:33: warning: shifting a negative
> signed value is undefined [-Wshift-negative-value]
> 1 warning        reg &= ~CONTROL1_TSEN_AVG_MASK <<
> CONTROL1_TSEN_AVG_SHIFT; generated
> .
>                ~~~~~~~~~~~~~~~~~~~~~~~ ^
> 
> CONTROL1_TSEN_AVG_SHIFT is defined to be zero.
> Since shifting by zero does nothing this variable can be removed.
> 
> Cc: clang-built-linux@googlegroups.com
> Link: https://github.com/ClangBuiltLinux/linux/issues/532
> Signed-off-by: Nathan Huckleberry <nhuck@google.com>

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>

> ---
>  drivers/thermal/armada_thermal.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
> index 8c07a393dc2e..709a22f455e9 100644
> --- a/drivers/thermal/armada_thermal.c
> +++ b/drivers/thermal/armada_thermal.c
> @@ -53,7 +53,6 @@
>  #define CONTROL0_TSEN_MODE_EXTERNAL	0x2
>  #define CONTROL0_TSEN_MODE_MASK		0x3
>  
> -#define CONTROL1_TSEN_AVG_SHIFT		0
>  #define CONTROL1_TSEN_AVG_MASK		0x7
>  #define CONTROL1_EXT_TSEN_SW_RESET	BIT(7)
>  #define CONTROL1_EXT_TSEN_HW_RESETn	BIT(8)
> @@ -267,8 +266,8 @@ static void armada_cp110_init(struct platform_device *pdev,
>  
>  	/* Average the output value over 2^1 = 2 samples */
>  	regmap_read(priv->syscon, data->syscon_control1_off, &reg);
> -	reg &= ~CONTROL1_TSEN_AVG_MASK << CONTROL1_TSEN_AVG_SHIFT;
> -	reg |= 1 << CONTROL1_TSEN_AVG_SHIFT;
> +	reg &= ~CONTROL1_TSEN_AVG_MASK;
> +	reg |= 1;
>  	regmap_write(priv->syscon, data->syscon_control1_off, reg);
>  }
>  
> 


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


  reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-13 18:49 Nathan Huckleberry
2019-06-14 10:11 ` Daniel Lezcano [this message]
2019-08-13 17:28   ` Nathan Huckleberry
2019-08-14 22:12     ` Nick Desaulniers
2019-08-14 23:06       ` Daniel Lezcano
2019-08-19  8:21         ` Miquel Raynal
2019-08-28  8:53           ` Zhang Rui
2019-08-28 18:49             ` Nick Desaulniers
2019-08-29  1:42               ` Zhang Rui

Reply instructions:

You may reply publically 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=27428324-129e-ee37-304a-0da2ed3810a0@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=edubezval@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=nhuck@google.com \
    --cc=rui.zhang@intel.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

Linux-PM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-pm/0 linux-pm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pm linux-pm/ https://lore.kernel.org/linux-pm \
		linux-pm@vger.kernel.org linux-pm@archiver.kernel.org
	public-inbox-index linux-pm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-pm


AGPL code for this site: git clone https://public-inbox.org/ public-inbox