linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: smartpqi_init: fix boolean expression in pqi_device_remove_start
@ 2019-01-03 16:47 Gustavo A. R. Silva
  2019-01-03 17:23 ` Don.Brace
  2019-01-04  6:02 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2019-01-03 16:47 UTC (permalink / raw)
  To: Mahesh Rajashekhara, Don Brace, James E.J. Bottomley, Martin K. Petersen
  Cc: esc.storagedev, linux-scsi, linux-kernel, Gustavo A. R. Silva

Fix boolean expression by using logical AND operator '&&'
instead of bitwise operator '&'.

This issue was detected with the help of Coccinelle.

Fixes: 1e46731efd9c ("scsi: smartpqi: check for null device pointers")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/scsi/smartpqi/smartpqi_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index e2fa3f476227..40f58238ce4a 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -323,7 +323,7 @@ static inline void pqi_device_remove_start(struct pqi_scsi_dev *device)
 static inline bool pqi_device_in_remove(struct pqi_ctrl_info *ctrl_info,
 					struct pqi_scsi_dev *device)
 {
-	return device->in_remove & !ctrl_info->in_shutdown;
+	return device->in_remove && !ctrl_info->in_shutdown;
 }
 
 static inline void pqi_schedule_rescan_worker_with_delay(
-- 
2.20.1


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

* RE: [PATCH] scsi: smartpqi_init: fix boolean expression in pqi_device_remove_start
  2019-01-03 16:47 [PATCH] scsi: smartpqi_init: fix boolean expression in pqi_device_remove_start Gustavo A. R. Silva
@ 2019-01-03 17:23 ` Don.Brace
  2019-01-04  6:02 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Don.Brace @ 2019-01-03 17:23 UTC (permalink / raw)
  To: gustavo, mahesh.rajashekhara, don.brace, jejb, martin.petersen
  Cc: esc.storagedev, linux-scsi, linux-kernel

-----Original Message-----
From: Gustavo A. R. Silva [mailto:gustavo@embeddedor.com] 
Sent: Thursday, January 3, 2019 10:48 AM
To: Mahesh Rajashekhara <mahesh.rajashekhara@microsemi.com>; Don Brace <don.brace@microsemi.com>; James E.J. Bottomley <jejb@linux.ibm.com>; Martin K. Petersen <martin.petersen@oracle.com>
Cc: esc.storagedev@microsemi.com; linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org; Gustavo A. R. Silva <gustavo@embeddedor.com>
Subject: [PATCH] scsi: smartpqi_init: fix boolean expression in pqi_device_remove_start

EXTERNAL EMAIL


Fix boolean expression by using logical AND operator '&&'
instead of bitwise operator '&'.

This issue was detected with the help of Coccinelle.

Fixes: 1e46731efd9c ("scsi: smartpqi: check for null device pointers")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Thanks for the update.
Acked-by: Don Brace <don.brace@microsemi.com>

---
 drivers/scsi/smartpqi/smartpqi_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index e2fa3f476227..40f58238ce4a 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -323,7 +323,7 @@ static inline void pqi_device_remove_start(struct pqi_scsi_dev *device)  static inline bool pqi_device_in_remove(struct pqi_ctrl_info *ctrl_info,
                                        struct pqi_scsi_dev *device)  {
-       return device->in_remove & !ctrl_info->in_shutdown;
+       return device->in_remove && !ctrl_info->in_shutdown;
 }

 static inline void pqi_schedule_rescan_worker_with_delay(
--
2.20.1


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

* Re: [PATCH] scsi: smartpqi_init: fix boolean expression in pqi_device_remove_start
  2019-01-03 16:47 [PATCH] scsi: smartpqi_init: fix boolean expression in pqi_device_remove_start Gustavo A. R. Silva
  2019-01-03 17:23 ` Don.Brace
@ 2019-01-04  6:02 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2019-01-04  6:02 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Mahesh Rajashekhara, Don Brace, James E.J. Bottomley,
	Martin K. Petersen, esc.storagedev, linux-scsi, linux-kernel


Gustavo,

> Fix boolean expression by using logical AND operator '&&' instead of
> bitwise operator '&'.

Applied to 4.21/scsi-fixes, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2019-01-04  6:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-03 16:47 [PATCH] scsi: smartpqi_init: fix boolean expression in pqi_device_remove_start Gustavo A. R. Silva
2019-01-03 17:23 ` Don.Brace
2019-01-04  6:02 ` Martin K. Petersen

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