silence warning in drivers/ata/libata-scsi.c when building W=1
PATCH 1/1 silence warning in drivers/ata/libata-scsi.c when building W=1
When building with W=1, we get these warnings:
drivers/ata/libata-scsi.c: In function 'ata_mselect_caching':drivers/ata/libata-scsi.c:3637:28: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
if (mpage[i + 2] & 0xfb != buf[i] & 0xfb) {
~~~~~^~~~~~~~~
drivers/ata/libata-scsi.c: In function 'ata_mselect_control':
drivers/ata/libata-scsi.c:3702:28: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
if (mpage[i + 2] & 0xfb != buf[i] & 0xfb) {
~~~~~^~~~~~~~~So give them the extra () and make things a bit clearer for both the compiler and programmer...
drivers/ata/libata-scsi.c +2 -2
@@ -3634,7 +3634,7 @@ static int ata_mselect_caching(struct ata_queued_cmd *qc,/* Check the first byte */ if (i ==0 ) {/* except the WCE bit */ -if (mpage[i +2 ] &0xfb != buf[i] &0xfb ) { +if ((mpage[i +2 ] &0xfb ) != (buf[i] &0xfb )) { *fp = i;return -EINVAL ; }else {
@@ -3699,7 +3699,7 @@ static int ata_mselect_control(struct ata_queued_cmd *qc,/* Check the first byte */ if (i ==0 ) {/* except the D_SENSE bit */ -if (mpage[i +2 ] &0xfb != buf[i] &0xfb ) { +if ((mpage[i +2 ] &0xfb ) != (buf[i] &0xfb )) { *fp = i;return -EINVAL ; }else {
Quoted 11 lines · Valdis Kletnieks
When building with W=1, we get these warnings:
drivers/ata/libata-scsi.c: In function 'ata_mselect_caching':drivers/ata/libata-scsi.c:3637:28: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]if (mpage[i + 2] & 0xfb != buf[i] & 0xfb) { ~~~~~^~~~~~~~~ drivers/ata/libata-scsi.c: In function 'ata_mselect_control': drivers/ata/libata-scsi.c:3702:28: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses] if (mpage[i + 2] & 0xfb != buf[i] & 0xfb) { ~~~~~^~~~~~~~~
Quoted 4 lines
So give them the extra () and make things a bit clearer for both the compiler and programmer...
Signed-off-by Valdis Kletnieks <[email protected]>
The offending commit got already reverted.
Thanks!
Signature · 1 line
tejun