[PATCH] staging: rtl8192u: Remove an unnecessary NULL check

Nathan Chancellor natechancellor at gmail.com
Wed May 22 20:39:23 UTC 2019


On Wed, May 22, 2019 at 10:04:18AM +0300, Dan Carpenter wrote:
> On Tue, May 21, 2019 at 10:42:21AM -0700, Nathan Chancellor wrote:
> > Clang warns:
> > 
> > drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:2663:47: warning:
> > address of array 'param->u.wpa_ie.data' will always evaluate to 'true'
> > [-Wpointer-bool-conversion]
> >             (param->u.wpa_ie.len && !param->u.wpa_ie.data))
> >                                     ~~~~~~~~~~~~~~~~~^~~~
> > 
> > This was exposed by commit deabe03523a7 ("Staging: rtl8192u: ieee80211:
> > Use !x in place of NULL comparisons") because we disable the warning
> > that would have pointed out the comparison against NULL is also false:
> > 
> 
> Heh.  Weird.  Why would people disable one and not the other?
> 
> regards,
> dan carpenter
> 

-Wtautological-compare has a lot of different sub-warnings under it,
one of which is the one shown. -Wno-tautological-compare turns off all
of those other sub-warnings. The reason that was done is there are quite
a few of them:

https://gist.github.com/nathanchance/3336adc6e796b57eadd53b106b96c569

https://clang.llvm.org/docs/DiagnosticsReference.html#wtautological-compare

It is probably worth looking into turning that on, I'm going to try to
do that as I have time.

Cheers,
Nathan


More information about the devel mailing list