Re: [PATCH] platform/x86: peaq-wmi: silence a static checker warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 18, 2017 at 06:08:30PM +0300, Andy Shevchenko wrote:
> On Tue, Jul 18, 2017 at 12:28 PM, Dan Carpenter
> <dan.carpenter@xxxxxxxxxx> wrote:
> > Static checkers complain because:
> >
> >         if (peaq_ignore_events_counter && --peaq_ignore_events_counter >= 0)
> >                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > The second part of the condition is always true because
> > "peaq_ignore_events_counter" is unsigned.  It doesn't cause a problem
> > because the first part of the condition prevents underflows, but it's
> > simple enough to make the static checker happy.
> 
> Isn't it the same to
> 
> if (peaq_ignore_events_counter && peaq_ignore_events_counter--)
> 
> ?

Yeah.  That's probably a little cleaner.  I'll resend.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux