RE: staging/dgap/dgap.c:981: bad if test ?

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

 



Hello there,

Thanks for the confirmation. More of the same in the same file:

[linux-3.19-rc5/drivers/staging/dgap/dgap.c:1022]: (warning) Logical disjunction always evaluates to true: module_type != 68 || module_type != 73.

Source code is

            if (module_type == 0 || module_type != PORTS ||
                module_type != MODEM) {

I used the static analyser cppcheck to find these two bugs, but
you might be able to find similar problems by using gcc compiler
flag -Wlogical-op.

Regards

David Binderman


----------------------------------------
> Date: Thu, 22 Jan 2015 13:14:22 +0300
> From: dan.carpenter@xxxxxxxxxx
> To: dcb314@xxxxxxxxxxx; daeseok.youn@xxxxxxxxx
> CC: driverdev-devel@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: staging/dgap/dgap.c:981: bad if test ?
>
>
> On Thu, Jan 22, 2015 at 10:05:53AM +0000, David Binderman wrote:
>> Hello there,
>>
>> [linux-3.19-rc5/drivers/staging/dgap/dgap.c:981]: (warning) Logical disjunction always evaluates to true: conc_type != 65 || conc_type != 66.
>>
>> Source code is
>>
>>             if (conc_type == 0 || conc_type != CX ||
>>                 conc_type != EPC) {
>>
>> Suggest code rework.
>
> Thanks. This bug was introduced in:
>
> commit f6aa0164cd3b1c5192e87f5651ec382c3bc3abac
> Author: Daeseok Youn <daeseok.youn@xxxxxxxxx>
> Date: Sat Aug 9 14:38:41 2014 +0900
>
> staging: dgap: Simplify to set a concentrator type
>
> It is same manner with setting a board type.
> For example of config file for concentrator,
> "conc ccon" or
> "conc epcon"
>
> After allocating a type of "CNODE" then set a type of concentrator.
> So remove cases in swith statement, just get a token from string
> and set to "conc.type". And also it doesn't need to "conc.v_type".
>
> Signed-off-by: Daeseok Youn <daeseok.youn@xxxxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>
> Let's CC Daeseok.
>
> 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