public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: aacraid: remove redundant zero check on ret
@ 2017-02-24 14:43 Colin King
  2017-02-26 20:01 ` Dave Carroll
  2017-02-28  3:20 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2017-02-24 14:43 UTC (permalink / raw)
  To: Adaptec OEM Raid Solutions, 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 ret being zero is redundant as a few statements earlier
we break out of the while loop if ret is non-zero.  Thus we can
remove the zero check and also the dead-code non-zero case too.

Detected by CoverityScan, CID#1411632 ("Logically Dead Code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/scsi/aacraid/commsup.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 1994c74..a3ad042 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -2508,8 +2508,7 @@ int aac_command_thread(void *data)
 			 && (now.tv_usec > (1000000 / HZ)))
 				difference = (((1000000 - now.tv_usec) * HZ)
 				  + 500000) / 1000000;
-			else if (ret == 0) {
-
+			else {
 				if (now.tv_usec > 500000)
 					++now.tv_sec;
 
@@ -2520,9 +2519,6 @@ int aac_command_thread(void *data)
 					ret = aac_send_hosttime(dev, &now);
 
 				difference = (long)(unsigned)update_interval*HZ;
-			} else {
-				/* retry shortly */
-				difference = 10 * HZ;
 			}
 			next_jiffies = jiffies + difference;
 			if (time_before(next_check_jiffies,next_jiffies))
-- 
2.10.2

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

* RE: [PATCH] scsi: aacraid: remove redundant zero check on ret
  2017-02-24 14:43 [PATCH] scsi: aacraid: remove redundant zero check on ret Colin King
@ 2017-02-26 20:01 ` Dave Carroll
  2017-02-28  3:20 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Carroll @ 2017-02-26 20:01 UTC (permalink / raw)
  To: Colin King, dl-esc-Aacraid Linux Driver, James E . J . Bottomley,
	Martin K . Petersen, linux-scsi@vger.kernel.org
  Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org

> -----Original Message-----
> From: Colin King [mailto:colin.king@canonical.com]
> Sent: Friday, February 24, 2017 7:44 AM
> To: dl-esc-Aacraid Linux Driver; James E . J . Bottomley; Martin K .
> Petersen; linux-scsi@vger.kernel.org
> Cc: kernel-janitors@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH] scsi: aacraid: remove redundant zero check on ret
> 
> From: Colin Ian King <colin.king@canonical.com>
> 
> The check for ret being zero is redundant as a few statements earlier we
> break out of the while loop if ret is non-zero.  Thus we can remove the
> zero check and also the dead-code non-zero case too.
> 
> Detected by CoverityScan, CID#1411632 ("Logically Dead Code")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/scsi/aacraid/commsup.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)

Acked-by: Dave Carroll <david.carroll@microsemi.com>

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

* Re: [PATCH] scsi: aacraid: remove redundant zero check on ret
  2017-02-24 14:43 [PATCH] scsi: aacraid: remove redundant zero check on ret Colin King
  2017-02-26 20:01 ` Dave Carroll
@ 2017-02-28  3:20 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2017-02-28  3:20 UTC (permalink / raw)
  To: Colin King
  Cc: Adaptec OEM Raid Solutions, James E . J . Bottomley,
	Martin K . Petersen, linux-scsi, kernel-janitors, linux-kernel

>>>>> "Colin" == Colin King <colin.king@canonical.com> writes:

Colin,

Colin> The check for ret being zero is redundant as a few statements
Colin> earlier we break out of the while loop if ret is non-zero.  Thus
Colin> we can remove the zero check and also the dead-code non-zero case
Colin> too.

Applied to 4.11/scsi-fixes.

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2017-02-28  3:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-24 14:43 [PATCH] scsi: aacraid: remove redundant zero check on ret Colin King
2017-02-26 20:01 ` Dave Carroll
2017-02-28  3:20 ` 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