Bug 46581 - rts_pstor/rtsx_scsi.c:2485: bad if test
Summary: rts_pstor/rtsx_scsi.c:2485: bad if test
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Staging (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: drivers_staging@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-28 17:18 UTC by David Binderman
Modified: 2012-11-08 14:20 UTC (History)
2 users (show)

See Also:
Kernel Version: 3.6-rc3
Subsystem:
Regression: No
Bisected commit-id:


Attachments

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

Note You need to log in before you can comment on or make changes to this bug.