public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] mfd: ab8500-debugfs.c:  Cleaning up unnecessary to test, unsigned can't be negative.
@ 2014-06-28 21:34 Rickard Strandqvist
  2014-07-02  6:54 ` Lee Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Rickard Strandqvist @ 2014-06-28 21:34 UTC (permalink / raw)
  To: linux-arm-kernel

Unsigned variable can't be negative so it is unnecessary to test it

This was found using a static code analysis program called cppcheck

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 drivers/mfd/ab8500-debugfs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c
index d1a22aa..0793a10 100644
--- a/drivers/mfd/ab8500-debugfs.c
+++ b/drivers/mfd/ab8500-debugfs.c
@@ -2504,7 +2504,7 @@ static ssize_t ab8500_gpadc_trig_timer_write(struct file *file,
 	if (err)
 		return err;
 
-	if ((user_trig_timer >= 0) && (user_trig_timer <= 255)) {
+	if (user_trig_timer <= 255) {
 		trig_timer = (u8) user_trig_timer;
 	} else {
 		dev_err(dev, "debugfs error input: "
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] mfd: ab8500-debugfs.c:  Cleaning up unnecessary to test, unsigned can't be negative.
  2014-06-28 21:34 [PATCH] mfd: ab8500-debugfs.c: Cleaning up unnecessary to test, unsigned can't be negative Rickard Strandqvist
@ 2014-07-02  6:54 ` Lee Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2014-07-02  6:54 UTC (permalink / raw)
  To: linux-arm-kernel

> Unsigned variable can't be negative so it is unnecessary to test it
> 
> This was found using a static code analysis program called cppcheck
> 
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
>  drivers/mfd/ab8500-debugfs.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

> diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c
> index d1a22aa..0793a10 100644
> --- a/drivers/mfd/ab8500-debugfs.c
> +++ b/drivers/mfd/ab8500-debugfs.c
> @@ -2504,7 +2504,7 @@ static ssize_t ab8500_gpadc_trig_timer_write(struct file *file,
>  	if (err)
>  		return err;
>  
> -	if ((user_trig_timer >= 0) && (user_trig_timer <= 255)) {
> +	if (user_trig_timer <= 255) {
>  		trig_timer = (u8) user_trig_timer;
>  	} else {
>  		dev_err(dev, "debugfs error input: "

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-02  6:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-28 21:34 [PATCH] mfd: ab8500-debugfs.c: Cleaning up unnecessary to test, unsigned can't be negative Rickard Strandqvist
2014-07-02  6:54 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox