All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: pinctrl-msm.c:  Cleaning up if unsigned is less than zero
@ 2014-06-26 11:31 Rickard Strandqvist
  2014-07-07 15:40 ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Rickard Strandqvist @ 2014-06-26 11:31 UTC (permalink / raw)
  To: Linus Walleij, linux-kernel; +Cc: Rickard Strandqvist

Remove checking if a unsigned is less than zero

This was found using a static code analysis program called cppcheck.

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

diff --git a/drivers/pinctrl/pinctrl-msm.c b/drivers/pinctrl/pinctrl-msm.c
index df6dda4c..cde8b2b 100644
--- a/drivers/pinctrl/pinctrl-msm.c
+++ b/drivers/pinctrl/pinctrl-msm.c
@@ -176,7 +176,7 @@ static void msm_pinmux_disable(struct pinctrl_dev *pctldev,
 
 	g = &pctrl->soc->groups[group];
 
-	if (WARN_ON(g->mux_bit < 0))
+	if (WARN_ON(g->mux_bit != 0))
 		return;
 
 	spin_lock_irqsave(&pctrl->lock, flags);
-- 
1.7.10.4


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

* Re: [PATCH] pinctrl: pinctrl-msm.c: Cleaning up if unsigned is less than zero
  2014-06-26 11:31 [PATCH] pinctrl: pinctrl-msm.c: Cleaning up if unsigned is less than zero Rickard Strandqvist
@ 2014-07-07 15:40 ` Linus Walleij
  2014-07-07 18:44   ` Rickard Strandqvist
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2014-07-07 15:40 UTC (permalink / raw)
  To: Rickard Strandqvist; +Cc: linux-kernel

On Thu, Jun 26, 2014 at 1:31 PM, Rickard Strandqvist
<rickard_strandqvist@spectrumdigital.se> wrote:

> Remove checking if a unsigned is less than zero
>
> This was found using a static code analysis program called cppcheck.
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
(...)
> -       if (WARN_ON(g->mux_bit < 0))
> +       if (WARN_ON(g->mux_bit != 0))

Is that correct?

If the variable cannot be < 0 should the check not simply be
deleted, since this is all it checks for?

Yours,
Linus Walleij

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

* Re: [PATCH] pinctrl: pinctrl-msm.c: Cleaning up if unsigned is less than zero
  2014-07-07 15:40 ` Linus Walleij
@ 2014-07-07 18:44   ` Rickard Strandqvist
  0 siblings, 0 replies; 3+ messages in thread
From: Rickard Strandqvist @ 2014-07-07 18:44 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-kernel

2014-07-07 17:40 GMT+02:00 Linus Walleij <linus.walleij@linaro.org>:
> On Thu, Jun 26, 2014 at 1:31 PM, Rickard Strandqvist
> <rickard_strandqvist@spectrumdigital.se> wrote:
>
>> Remove checking if a unsigned is less than zero
>>
>> This was found using a static code analysis program called cppcheck.
>>
>> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> (...)
>> -       if (WARN_ON(g->mux_bit < 0))
>> +       if (WARN_ON(g->mux_bit != 0))
>
> Is that correct?
>
> If the variable cannot be < 0 should the check not simply be
> deleted, since this is all it checks for?


Hi Linus!

Yes, it was a bit silly. Do not really know how that happened :-/

I guess I thought it was reasonable. But I should do as I have tried
to do in all other cases, the smallest possible change. And let you
check in code, if so, to capture what is missing.

New patch on the way!


Kind regards
Rickard Strandqvist

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

end of thread, other threads:[~2014-07-07 18:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-26 11:31 [PATCH] pinctrl: pinctrl-msm.c: Cleaning up if unsigned is less than zero Rickard Strandqvist
2014-07-07 15:40 ` Linus Walleij
2014-07-07 18:44   ` Rickard Strandqvist

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.