Re: [PATCH] staging: rtl8192u: r8192U_core.c: Cleaning up uninitialized variables

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

 



Hi Dan!


Now this is a bad example because there is nothing really wrong, and I
could not find the original error log :-(


But i get for the testing variable:
drivers/staging/rtl8192u/r8192U_core.c : 4747] :  (style) Variable
'testing' is assigned a value that is never used.


And for the this file i now get:

drivers/staging/rtl8192u/r8192U_core.c : 1014] :  (style) Variable
'ret' is assigned a value that is never used.
drivers/staging/rtl8192u/r8192U_core.c : 1258] :  (error) Possible
null pointer dereference :  dev
drivers/staging/rtl8192u/r8192U_core.c : 1411] :  (style) Variable
'rate_config' is assigned a value that is never used.
drivers/staging/rtl8192u/r8192U_core.c : 1908] :  (portability)
'oldaddr' is of type 'void *'. When using void pointers in
calculations, the behaviour is undefined.
drivers/staging/rtl8192u/r8192U_core.c : 1959] :  (style) Unused variable :  i
drivers/staging/rtl8192u/r8192U_core.c : 2040] ->
[drivers/staging/rtl8192u/r8192U.h : 1129] :  (style, inconclusive)
The struct 'r8192_priv' hides a typedef with the same name.
drivers/staging/rtl8192u/r8192U_core.c : 2041] ->
[drivers/staging/rtl8192u/r8192U_core.c : 2048] :  (warning) Possible
null pointer dereference :  priv - otherwise it is redundant to check
it against null.




But why not test yourself, see:


http://cppcheck.sourceforge.net/


Appropriate arguments to start with are:
cppcheck --force --quiet  --enable=all drivers/staging/rtl8192u/r8192U_core.c


Best regards
Rickard Strandqvist


2014-06-02 9:39 GMT+02:00 Dan Carpenter <dan.carpenter@xxxxxxxxxx>:
> On Sun, Jun 01, 2014 at 11:05:39PM +0200, Rickard Strandqvist wrote:
>> Hi Dan
>>
>> I agree, this looks strange.
>> Have been looking for a while in history with, to see if the code has
>> been removed. I start my search using cppcheck for over three months
>> ago.
>> But could not find anything. Sorry about that :-(
>>
>> But I'll make a patch that completely removes testing variable then instead?
>
> Yes.  Btw, what do the cppcheck error messages for this look like
> anyway?
>
> regards,
> dan carpenter
>
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux