LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] scsi: snic: Remove redundant assignment to variable ret
@ 2021-08-06 11:23 Colin King
  2021-08-10  3:24 ` Martin K. Petersen
  2021-08-17  3:17 ` Martin K. Petersen
  0 siblings, 2 replies; 5+ messages in thread
From: Colin King @ 2021-08-06 11:23 UTC (permalink / raw)
  To: Karan Tilak Kumar, Sesidhar Baddela, James E . J . Bottomley,
	Martin K . Petersen, linux-scsi
  Cc: kernel-janitors, linux-kernel

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

The variable ret is being initialized with a value that is never read,
the assignment is redundant and can be removed.

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

diff --git a/drivers/scsi/snic/snic_scsi.c b/drivers/scsi/snic/snic_scsi.c
index 6dd0ff188bb4..92f5b65c2a27 100644
--- a/drivers/scsi/snic/snic_scsi.c
+++ b/drivers/scsi/snic/snic_scsi.c
@@ -2383,7 +2383,7 @@ snic_host_reset(struct scsi_cmnd *sc)
 {
 	struct Scsi_Host *shost = sc->device->host;
 	u32 start_time  = jiffies;
-	int ret = FAILED;
+	int ret;
 
 	SNIC_SCSI_DBG(shost,
 		      "host reset:sc %p sc_cmd 0x%x req %p tag %d flags 0x%llx\n",
-- 
2.31.1


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

* Re: [PATCH] scsi: snic: Remove redundant assignment to variable ret
  2021-08-06 11:23 [PATCH] scsi: snic: Remove redundant assignment to variable ret Colin King
@ 2021-08-10  3:24 ` Martin K. Petersen
  2021-08-17  3:17 ` Martin K. Petersen
  1 sibling, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2021-08-10  3:24 UTC (permalink / raw)
  To: Colin King
  Cc: Karan Tilak Kumar, Sesidhar Baddela, James E . J . Bottomley,
	Martin K . Petersen, linux-scsi, kernel-janitors, linux-kernel


Colin,

> The variable ret is being initialized with a value that is never read,
> the assignment is redundant and can be removed.

Applied to 5.15/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] scsi: snic: Remove redundant assignment to variable ret
  2021-08-06 11:23 [PATCH] scsi: snic: Remove redundant assignment to variable ret Colin King
  2021-08-10  3:24 ` Martin K. Petersen
@ 2021-08-17  3:17 ` Martin K. Petersen
  1 sibling, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2021-08-17  3:17 UTC (permalink / raw)
  To: Karan Tilak Kumar, Colin King, James E . J . Bottomley,
	linux-scsi, Sesidhar Baddela
  Cc: Martin K . Petersen, kernel-janitors, linux-kernel

On Fri, 6 Aug 2021 12:23:13 +0100, Colin King wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable ret is being initialized with a value that is never read,
> the assignment is redundant and can be removed.
> 
> 
> 
> [...]

Applied to 5.15/scsi-queue, thanks!

[1/1] scsi: snic: Remove redundant assignment to variable ret
      https://git.kernel.org/mkp/scsi/c/e9b1adb7c5e3

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] scsi: snic: remove redundant assignment to variable ret
  2019-07-31 22:49 [PATCH] scsi: snic: remove " Colin King
@ 2019-08-06 13:17 ` Dan Carpenter
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2019-08-06 13:17 UTC (permalink / raw)
  To: Colin King
  Cc: Karan Tilak Kumar, Sesidhar Baddela, James E . J . Bottomley,
	Martin K . Petersen, linux-scsi, kernel-janitors, linux-kernel

On Wed, Jul 31, 2019 at 11:49:50PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Variable ret is being assigned with a value that is never read as
> there is return statement immediately afterwards.  The assignment
> is redundant and hence can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/scsi/snic/snic_disc.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/scsi/snic/snic_disc.c b/drivers/scsi/snic/snic_disc.c
> index e9ccfb97773f..d89c75991323 100644
> --- a/drivers/scsi/snic/snic_disc.c
> +++ b/drivers/scsi/snic/snic_disc.c
> @@ -261,8 +261,6 @@ snic_tgt_create(struct snic *snic, struct snic_tgt_id *tgtid)
>  	tgt = kzalloc(sizeof(*tgt), GFP_KERNEL);
>  	if (!tgt) {
>  		SNIC_HOST_ERR(snic->shost, "Failure to allocate snic_tgt.\n");
> -		ret = -ENOMEM;
> -
>  		return tgt;

Not related to this patch, but it would be nicer to return NULL instead
of tgt.  It's the same but the literal is nicer.  No need for the error
message after a kmalloc failure either.

	tgt = kzalloc(sizeof(*tgt), GFP_KERNEL);
	if (!tgt)
		return NULL;

regards,
dan carpenter


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

* [PATCH] scsi: snic: remove redundant assignment to variable ret
@ 2019-07-31 22:49 Colin King
  2019-08-06 13:17 ` Dan Carpenter
  0 siblings, 1 reply; 5+ messages in thread
From: Colin King @ 2019-07-31 22:49 UTC (permalink / raw)
  To: Karan Tilak Kumar, Sesidhar Baddela, James E . J . Bottomley,
	Martin K . Petersen, linux-scsi
  Cc: kernel-janitors, linux-kernel

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

Variable ret is being assigned with a value that is never read as
there is return statement immediately afterwards.  The assignment
is redundant and hence can be removed.

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

diff --git a/drivers/scsi/snic/snic_disc.c b/drivers/scsi/snic/snic_disc.c
index e9ccfb97773f..d89c75991323 100644
--- a/drivers/scsi/snic/snic_disc.c
+++ b/drivers/scsi/snic/snic_disc.c
@@ -261,8 +261,6 @@ snic_tgt_create(struct snic *snic, struct snic_tgt_id *tgtid)
 	tgt = kzalloc(sizeof(*tgt), GFP_KERNEL);
 	if (!tgt) {
 		SNIC_HOST_ERR(snic->shost, "Failure to allocate snic_tgt.\n");
-		ret = -ENOMEM;
-
 		return tgt;
 	}
 
-- 
2.20.1


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

end of thread, other threads:[~2021-08-17  3:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06 11:23 [PATCH] scsi: snic: Remove redundant assignment to variable ret Colin King
2021-08-10  3:24 ` Martin K. Petersen
2021-08-17  3:17 ` Martin K. Petersen
  -- strict thread matches above, loose matches on Subject: below --
2019-07-31 22:49 [PATCH] scsi: snic: remove " Colin King
2019-08-06 13:17 ` Dan Carpenter

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