diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-01-05 14:22:15 +0100 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-01-05 14:22:15 +0100 |
commit | e013a9371d567af6504ed38befb6e866faf7afe7 (patch) | |
tree | 5270b4cc9786ae124d28cb169eae335d9796b9a0 /linux/src/drivers | |
parent | 5faed5128d3c07f055f96d910529c95814073a09 (diff) |
linux: fix bit tests
The pattern is !x&y. An expression of this form is almost always
meaningless, because it combines a boolean operator with a bit
operator. In particular, if the rightmost bit of y is 0, the result
will always be 0.
Fixed using coccinelle.
// !x&y combines boolean negation with bitwise and
//
// Confidence: High
// Copyright: (C) Gilles Muller, Julia Lawall, EMN, DIKU. GPLv2.
// URL: http://www.emn.fr/x-info/coccinelle/rules/notand.html
// Options:
@@ expression E1,E2; @@
(
!E1 & !E2
|
- !E1 & E2
+ !(E1 & E2)
)
* linux/src/drivers/scsi/FlashPoint.c: Fix bit tests.
Diffstat (limited to 'linux/src/drivers')
-rw-r--r-- | linux/src/drivers/scsi/FlashPoint.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/linux/src/drivers/scsi/FlashPoint.c b/linux/src/drivers/scsi/FlashPoint.c index 4b96a66..8d2f102 100644 --- a/linux/src/drivers/scsi/FlashPoint.c +++ b/linux/src/drivers/scsi/FlashPoint.c @@ -3756,17 +3756,17 @@ STATIC int SetDevSyncRate(PSCCBcard pCurrCard, PUCB p_ucb) } if(currTar_Info->TarEEValue && EE_SYNC_MASK == syncVal) return(0); - currTar_Info->TarEEValue = (currTar_Info->TarEEValue & !EE_SYNC_MASK) + currTar_Info->TarEEValue = (!(EE_SYNC_MASK & currTar_Info->TarEEValue)) | syncVal; syncOffset = (SYNC_RATE_TBL + scsiID) / 2; temp2.tempw = utilEERead(ioPort, syncOffset); if(scsiID & 0x01) { - temp2.tempb[0] = (temp2.tempb[0] & !EE_SYNC_MASK) | syncVal; + temp2.tempb[0] = (!(EE_SYNC_MASK & temp2.tempb[0])) | syncVal; } else { - temp2.tempb[1] = (temp2.tempb[1] & !EE_SYNC_MASK) | syncVal; + temp2.tempb[1] = (!(EE_SYNC_MASK & temp2.tempb[1])) | syncVal; } utilEEWriteOnOff(ioPort, 1); utilEEWrite(ioPort, temp2.tempw, syncOffset); @@ -3854,18 +3854,18 @@ int SetDevWideMode(PSCCBcard pCurrCard,PUCB p_ucb) scsiWideMode = 0; } } - currTar_Info->TarEEValue = (currTar_Info->TarEEValue & !EE_WIDE_SCSI) + currTar_Info->TarEEValue = (!(EE_WIDE_SCSI & currTar_Info->TarEEValue)) | scsiWideMode; syncOffset = (SYNC_RATE_TBL + scsiID) / 2; temp2.tempw = utilEERead(ioPort, syncOffset); if(scsiID & 0x01) { - temp2.tempb[0] = (temp2.tempb[0] & !EE_WIDE_SCSI) | scsiWideMode; + temp2.tempb[0] = (!(EE_WIDE_SCSI & temp2.tempb[0])) | scsiWideMode; } else { - temp2.tempb[1] = (temp2.tempb[1] & !EE_WIDE_SCSI) | scsiWideMode; + temp2.tempb[1] = (!(EE_WIDE_SCSI & temp2.tempb[1])) | scsiWideMode; } utilEEWriteOnOff(ioPort, 1); utilEEWrite(ioPort, temp2.tempw, syncOffset); |