diff mbox series

scsi: libsas: remove redundant assignment to variable res

Message ID 20200722154404.959267-1-colin.king@canonical.com (mailing list archive)
State Mainlined
Commit 55eb809f5e1c6d2a57e4c24a574fe09065e62534
Headers show
Series scsi: libsas: remove redundant assignment to variable res | expand

Commit Message

Colin King July 22, 2020, 3:44 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The variable res 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/libsas/sas_expander.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

John Garry July 22, 2020, 3:59 p.m. UTC | #1
On 22/07/2020 16:44, Colin King wrote:
> From: Colin Ian King<colin.king@canonical.com>
> 
> The variable res 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>

Reviewed-by: John Garry <john.garry@huawei.com>
Martin K. Petersen July 25, 2020, 2:50 a.m. UTC | #2
On Wed, 22 Jul 2020 16:44:04 +0100, Colin King wrote:

> The variable res 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: libsas: Remove redundant assignment to variable res
      https://git.kernel.org/mkp/scsi/c/55eb809f5e1c
diff mbox series

Patch

diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index ab671cdd4cfb..b7d1b1ea185d 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -427,7 +427,7 @@  int sas_ex_phy_discover(struct domain_device *dev, int single)
 static int sas_expander_discover(struct domain_device *dev)
 {
 	struct expander_device *ex = &dev->ex_dev;
-	int res = -ENOMEM;
+	int res;
 
 	ex->ex_phy = kcalloc(ex->num_phys, sizeof(*ex->ex_phy), GFP_KERNEL);
 	if (!ex->ex_phy)