kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: isci: remove redundant initialization to 'bit'
@ 2018-02-06 14:12 Colin King
  2018-02-09 23:50 ` Martin K. Petersen
  2020-07-23 14:26 ` [PATCH] scsi: isci: remove redundant initialization of variable status Colin King
  0 siblings, 2 replies; 4+ messages in thread
From: Colin King @ 2018-02-06 14:12 UTC (permalink / raw)
  To: Intel SCU Linux support, Artur Paszkiewicz,
	James E . J . Bottomley, Martin K . Petersen, linux-scsi
  Cc: kernel-janitors, linux-kernel

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

Variable bit is initialized with a value that is never read and is
being updated immediately after the initialization, hence the
initialization is redundant and can be removed.

Cleans up clang warning:
drivers/scsi/isci/host.c:2769:8: warning: Value stored to 'bit' during
its initialization is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/scsi/isci/host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c
index 13b37cdffa8e..1ee3868ade07 100644
--- a/drivers/scsi/isci/host.c
+++ b/drivers/scsi/isci/host.c
@@ -2766,7 +2766,7 @@ static int sci_write_gpio_tx_gp(struct isci_host *ihost, u8 reg_index, u8 reg_co
 		int i;
 
 		for (i = 0; i < 3; i++) {
-			int bit = (i << 2) + 2;
+			int bit;
 
 			bit = try_test_sas_gpio_gp_bit(to_sas_gpio_od(d, i),
 						       write_data, reg_index,
-- 
2.15.1


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

* Re: [PATCH] scsi: isci: remove redundant initialization to 'bit'
  2018-02-06 14:12 [PATCH] scsi: isci: remove redundant initialization to 'bit' Colin King
@ 2018-02-09 23:50 ` Martin K. Petersen
  2020-07-23 14:26 ` [PATCH] scsi: isci: remove redundant initialization of variable status Colin King
  1 sibling, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2018-02-09 23:50 UTC (permalink / raw)
  To: Colin King
  Cc: Intel SCU Linux support, Artur Paszkiewicz,
	James E . J . Bottomley, Martin K . Petersen, linux-scsi,
	kernel-janitors, linux-kernel


Colin,

> Variable bit is initialized with a value that is never read and is
> being updated immediately after the initialization, hence the
> initialization is redundant and can be removed.

Applied to 4.17/scsi-queue. Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* [PATCH] scsi: isci: remove redundant initialization of variable status
  2018-02-06 14:12 [PATCH] scsi: isci: remove redundant initialization to 'bit' Colin King
  2018-02-09 23:50 ` Martin K. Petersen
@ 2020-07-23 14:26 ` Colin King
  2020-07-25  2:50   ` Martin K. Petersen
  1 sibling, 1 reply; 4+ messages in thread
From: Colin King @ 2020-07-23 14:26 UTC (permalink / raw)
  To: Intel SCU Linux support, Artur Paszkiewicz,
	James E . J . Bottomley, Martin K . Petersen, linux-scsi
  Cc: kernel-janitors, linux-kernel

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

The variable status 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/isci/request.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c
index 343d24c7e788..6561a07db189 100644
--- a/drivers/scsi/isci/request.c
+++ b/drivers/scsi/isci/request.c
@@ -3444,7 +3444,7 @@ struct isci_request *isci_tmf_request_from_tag(struct isci_host *ihost,
 int isci_request_execute(struct isci_host *ihost, struct isci_remote_device *idev,
 			 struct sas_task *task, u16 tag)
 {
-	enum sci_status status = SCI_FAILURE_UNSUPPORTED_PROTOCOL;
+	enum sci_status status;
 	struct isci_request *ireq;
 	unsigned long flags;
 	int ret = 0;
-- 
2.27.0

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

* Re: [PATCH] scsi: isci: remove redundant initialization of variable status
  2020-07-23 14:26 ` [PATCH] scsi: isci: remove redundant initialization of variable status Colin King
@ 2020-07-25  2:50   ` Martin K. Petersen
  0 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2020-07-25  2:50 UTC (permalink / raw)
  To: Artur Paszkiewicz, linux-scsi, James E . J . Bottomley,
	Intel SCU Linux support, Colin King
  Cc: Martin K . Petersen, linux-kernel, kernel-janitors

On Thu, 23 Jul 2020 15:26:14 +0100, Colin King wrote:

> The variable status 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.9/scsi-queue, thanks!

[1/1] scsi: isci: Remove redundant initialization of variable 'status'
      https://git.kernel.org/mkp/scsi/c/584d902eb10e

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2020-07-25  2:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-06 14:12 [PATCH] scsi: isci: remove redundant initialization to 'bit' Colin King
2018-02-09 23:50 ` Martin K. Petersen
2020-07-23 14:26 ` [PATCH] scsi: isci: remove redundant initialization of variable status Colin King
2020-07-25  2:50   ` 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).