linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] silence warning in drivers/ata/libata-scsi.c when building W=1
@ 2016-08-01  3:28 Valdis Kletnieks
  2016-08-01 15:04 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Valdis Kletnieks @ 2016-08-01  3:28 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-ide, linux-kernel

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...

Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index fa9d16fe295c..8ad4b237f342 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -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 {



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] silence warning in drivers/ata/libata-scsi.c when building W=1
  2016-08-01  3:28 [PATCH] silence warning in drivers/ata/libata-scsi.c when building W=1 Valdis Kletnieks
@ 2016-08-01 15:04 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2016-08-01 15:04 UTC (permalink / raw)
  To: Valdis Kletnieks; +Cc: linux-ide, linux-kernel

On Sun, Jul 31, 2016 at 11:28:34PM -0400, Valdis Kletnieks wrote:
> 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...
> 
> Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>

The offending commit got already reverted.

Thanks!

-- 
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-01 15:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-01  3:28 [PATCH] silence warning in drivers/ata/libata-scsi.c when building W=1 Valdis Kletnieks
2016-08-01 15:04 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).