kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: qla4xxx: remove redundant check on drvr_wait
@ 2018-09-26 13:08 Colin King
  2018-09-27 11:15 ` Rangankar, Manish
  2018-09-28  6:30 ` [PATCH] scsi: qla4xxx: remove redundant check on drvr_wait Martin K. Petersen
  0 siblings, 2 replies; 6+ messages in thread
From: Colin King @ 2018-09-26 13:08 UTC (permalink / raw)
  To: QLogic-Storage-Upstream, James E . J . Bottomley,
	Martin K . Petersen, linux-scsi
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The check for a non-zero drvr_wait is redundant as the same check
is performed earlier in the outer while loop, the inner check will
always be true if we reached this point inside the while loop.
Remove the redundant if check.

Detected by cppcheck:
(warning) Identical inner 'if' condition is always true.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/scsi/qla4xxx/ql4_init.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index 52b1a0bc93c9..1ef74aa2d00a 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -766,12 +766,10 @@ int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a)
 	while (drvr_wait) {
 		if (ql4xxx_lock_drvr(a) = 0) {
 			ssleep(QL4_LOCK_DRVR_SLEEP);
-			if (drvr_wait) {
-				DEBUG2(printk("scsi%ld: %s: Waiting for "
-					      "Global Init Semaphore(%d)...\n",
-					      a->host_no,
-					      __func__, drvr_wait));
-			}
+			DEBUG2(printk("scsi%ld: %s: Waiting for "
+				      "Global Init Semaphore(%d)...\n",
+				      a->host_no,
+				      __func__, drvr_wait));
 			drvr_wait -= QL4_LOCK_DRVR_SLEEP;
 		} else {
 			DEBUG2(printk("scsi%ld: %s: Global Init Semaphore "
-- 
2.17.1

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

* RE: [PATCH] scsi: qla4xxx: remove redundant check on drvr_wait
  2018-09-26 13:08 [PATCH] scsi: qla4xxx: remove redundant check on drvr_wait Colin King
@ 2018-09-27 11:15 ` Rangankar, Manish
  2020-12-04 19:18   ` [PATCH] scsi: qla4xxx: remove redundant assignment to variable rval Colin King
  2018-09-28  6:30 ` [PATCH] scsi: qla4xxx: remove redundant check on drvr_wait Martin K. Petersen
  1 sibling, 1 reply; 6+ messages in thread
From: Rangankar, Manish @ 2018-09-27 11:15 UTC (permalink / raw)
  To: Colin King, Dept-Eng QLogic Storage Upstream,
	James E . J . Bottomley, Martin K . Petersen, linux-scsi
  Cc: kernel-janitors, linux-kernel

DQo+IC0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQo+IEZyb206IENvbGluIEtpbmcgPGNvbGlu
LmtpbmdAY2Fub25pY2FsLmNvbT4NCj4gU2VudDogV2VkbmVzZGF5LCBTZXB0ZW1iZXIgMjYsIDIw
MTggNjozOSBQTQ0KPiBUbzogRGVwdC1FbmcgUUxvZ2ljIFN0b3JhZ2UgVXBzdHJlYW0gPFFMb2dp
Yy1TdG9yYWdlLQ0KPiBVcHN0cmVhbUBjYXZpdW0uY29tPjsgSmFtZXMgRSAuIEogLiBCb3R0b21s
ZXkgPGplamJAbGludXgudm5ldC5pYm0uY29tPjsNCj4gTWFydGluIEsgLiBQZXRlcnNlbiA8bWFy
dGluLnBldGVyc2VuQG9yYWNsZS5jb20+OyBsaW51eC1zY3NpQHZnZXIua2VybmVsLm9yZw0KPiBD
Yzoga2VybmVsLWphbml0b3JzQHZnZXIua2VybmVsLm9yZzsgbGludXgta2VybmVsQHZnZXIua2Vy
bmVsLm9yZw0KPiBTdWJqZWN0OiBbUEFUQ0hdIHNjc2k6IHFsYTR4eHg6IHJlbW92ZSByZWR1bmRh
bnQgY2hlY2sgb24gZHJ2cl93YWl0DQo+IA0KPiBFeHRlcm5hbCBFbWFpbA0KPiANCj4gRnJvbTog
Q29saW4gSWFuI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eHh4X2xv
Y2tfZHJ2cl93YWl0KHN0cnVjdCBzY3NpX3FsYV9ob3N0ICphKQ0KPiAgICAgICAgIHdoaWxlIChk
cnZyX3dhaXQpIHsNCj4gICAgICAgICAgICAgICAgIGlmIChxbDR4eHhfbG9ja19kcnZyKGEpID09
IDApIHsNCj4gICAgICAgICAgICAgICAgICAgICAgICAgc3NsZWVwKFFMNF9MT0NLX0RSVlJfU0xF
RVApOw0KPiAtICAgICAgICAgICAgICAgICAgICAgICBpZiAoZHJ2cl93YWl0KSB7DQo+IC0gICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgREVCVUcyKHByaW50aygic2NzaSVsZDogJXM6IFdh
aXRpbmcgZm9yICINCj4gLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICJHbG9iYWwgSW5pdCBTZW1hcGhvcmUoJWQpLi4uXG4iLA0KPiAtICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS0+aG9zdF9ubywNCj4gLSAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fZnVuY19fLCBkcnZyX3dhaXQpKTsN
Cj4gLSAgICAgICAgICAgICAgICAgICAgICAgfQ0KPiArICAgICAgICAgICAgICAgICAgICAgICBE
RUJVRzIocHJpbnRrKCJzY3NpJWxkOiAlczogV2FpdGluZyBmb3IgIg0KPiArICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICJHbG9iYWwgSW5pdCBTZW1hcGhvcmUoJWQpLi4uXG4i
LA0KPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEtPmhvc3Rfbm8sDQo+
ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19mdW5jX18sIGRydnJfd2Fp
dCkpOw0KPiAgICAgICAgICAgICAgICAgICAgICAgICBkcnZyX3dhaXQgLT0gUUw0X0xPQ0tfRFJW
Ul9TTEVFUDsNCj4gICAgICAgICAgICAgICAgIH0gZWxzZSB7DQo+ICAgICAgICAgICAgICAgICAg
ICAgICAgIERFQlVHMihwcmludGsoInNjc2klbGQ6ICVzOiBHbG9iYWwgSW5pdCBTZW1hcGhvcmUg
Ig0KPiAtLQ0KPiAyLjE3LjENCg0KVGhhbmtzLA0KDQpBY2tlZC1ieTogTWFuaXNoIFJhbmdhbmth
ciA8TWFuaXNoLlJhbmdhbmthckBjYXZpdW0uY29tPg0K

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

* Re: [PATCH] scsi: qla4xxx: remove redundant check on drvr_wait
  2018-09-26 13:08 [PATCH] scsi: qla4xxx: remove redundant check on drvr_wait Colin King
  2018-09-27 11:15 ` Rangankar, Manish
@ 2018-09-28  6:30 ` Martin K. Petersen
  1 sibling, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2018-09-28  6:30 UTC (permalink / raw)
  To: Colin King
  Cc: QLogic-Storage-Upstream, James E . J . Bottomley,
	Martin K . Petersen, linux-scsi, kernel-janitors, linux-kernel


Colin,

> The check for a non-zero drvr_wait is redundant as the same check is
> performed earlier in the outer while loop, the inner check will always
> be true if we reached this point inside the while loop.  Remove the
> redundant if check.

Applied to 4.20/scsi-queue. Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* [PATCH] scsi: qla4xxx: remove redundant assignment to variable rval
  2018-09-27 11:15 ` Rangankar, Manish
@ 2020-12-04 19:18   ` Colin King
  2020-12-08  1:58     ` Martin K. Petersen
  2020-12-09 17:23     ` Martin K. Petersen
  0 siblings, 2 replies; 6+ messages in thread
From: Colin King @ 2020-12-04 19:18 UTC (permalink / raw)
  To: Nilesh Javali, Manish Rangankar, GR-QLogic-Storage-Upstream,
	James E . J . Bottomley, Martin K . Petersen, linux-scsi
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The variable rval is being initialized with a value that is never read
and it is being updated later with a new value.  The initialization is
redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/scsi/qla4xxx/ql4_nx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
index fd30fbd0d33c..e6e35e6958f6 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.c
+++ b/drivers/scsi/qla4xxx/ql4_nx.c
@@ -1767,7 +1767,7 @@ qla4_82xx_start_firmware(struct scsi_qla_host *ha, uint32_t image_start)
 
 int qla4_82xx_try_start_fw(struct scsi_qla_host *ha)
 {
-	int rval = QLA_ERROR;
+	int rval;
 
 	/*
 	 * FW Load priority:
-- 
2.29.2

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

* Re: [PATCH] scsi: qla4xxx: remove redundant assignment to variable rval
  2020-12-04 19:18   ` [PATCH] scsi: qla4xxx: remove redundant assignment to variable rval Colin King
@ 2020-12-08  1:58     ` Martin K. Petersen
  2020-12-09 17:23     ` Martin K. Petersen
  1 sibling, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2020-12-08  1:58 UTC (permalink / raw)
  To: Colin King
  Cc: Nilesh Javali, Manish Rangankar, GR-QLogic-Storage-Upstream,
	James E . J . Bottomley, Martin K . Petersen, linux-scsi,
	kernel-janitors, linux-kernel


Colin,

> The variable rval is being initialized with a value that is never read
> and it is being updated later with a new value.  The initialization is
> redundant and can be removed.

Applied to 5.11/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] scsi: qla4xxx: remove redundant assignment to variable rval
  2020-12-04 19:18   ` [PATCH] scsi: qla4xxx: remove redundant assignment to variable rval Colin King
  2020-12-08  1:58     ` Martin K. Petersen
@ 2020-12-09 17:23     ` Martin K. Petersen
  1 sibling, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2020-12-09 17:23 UTC (permalink / raw)
  To: Nilesh Javali, James E . J . Bottomley, Manish Rangankar,
	Colin King, linux-scsi, GR-QLogic-Storage-Upstream
  Cc: Martin K . Petersen, kernel-janitors, linux-kernel

On Fri, 4 Dec 2020 19:18:10 +0000, Colin King wrote:

> The variable rval is being initialized with a value that is never read
> and it is being updated later with a new value.  The initialization is
> redundant and can be removed.

Applied to 5.11/scsi-queue, thanks!

[1/1] scsi: qla4xxx: remove redundant assignment to variable rval
      https://git.kernel.org/mkp/scsi/c/3a5b9fa2cc5f

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2020-12-09 17:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-26 13:08 [PATCH] scsi: qla4xxx: remove redundant check on drvr_wait Colin King
2018-09-27 11:15 ` Rangankar, Manish
2020-12-04 19:18   ` [PATCH] scsi: qla4xxx: remove redundant assignment to variable rval Colin King
2020-12-08  1:58     ` Martin K. Petersen
2020-12-09 17:23     ` Martin K. Petersen
2018-09-28  6:30 ` [PATCH] scsi: qla4xxx: remove redundant check on drvr_wait 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).