Bug 46581

Summary: rts_pstor/rtsx_scsi.c:2485: bad if test
Product: Drivers Reporter: David Binderman (dcb314)
Component: StagingAssignee: drivers_staging (drivers_staging)
Status: RESOLVED CODE_FIX    
Severity: normal CC: alan, florian
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.6-rc3 Subsystem:
Regression: No Bisected commit-id:

Description David Binderman 2012-08-28 17:18:55 UTC
I just tried out the extra compiler flag -Wlogical-op
on the source code of the linux kernel 3.6-rc3.

The compiler said

drivers/staging/rts_pstor/rtsx_scsi.c: In function ‘spi_vendor_cmd’:
drivers/staging/rts_pstor/rtsx_scsi.c:2485:2: warning: logical ‘and’ of mutually exclusive tests is always false [-Wlogical-op]
  if (CHECK_PID(chip, 0x5208) && CHECK_PID(chip, 0x5288)) {

but

drivers/staging/rts_pstor/rtsx_chip.h:#define CHECK_PID(chip, pid)		((chip)->product_id == (pid))

Suggest replace && with || in the if test.
Comment 1 Greg Kroah-Hartman 2012-08-28 17:42:08 UTC
On Tue, Aug 28, 2012 at 05:18:55PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=46581

Please send a patch through email for this issue, I can't take fixes
from bugzilla.
Comment 2 Florian Mickler 2012-10-15 21:26:24 UTC
A patch referencing this bug report has been merged in Linux v3.7-rc1:

commit 0ff15d54161cc0e57fed79de1b5731c81225d668
Author: Alan Cox <alan@linux.intel.com>
Date:   Tue Sep 4 15:23:46 2012 +0100

    staging: rts_pstor: Fix invalid check