From e013a9371d567af6504ed38befb6e866faf7afe7 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Sun, 5 Jan 2014 14:22:15 +0100 Subject: 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. --- linux/src/drivers/scsi/FlashPoint.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'linux') 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); -- cgit v1.2.3