Skip to contentSkip to conversation

scsi: libsas: remove redundant assignment to variable res

PATCH Applied Colin King 3 participants 3 messages Jul 22, 2020 – Jul 25, 2020

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 scsi: libsas: remove redundant assignment to variable res

From: Colin Ian King <[email protected]>

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

---
 drivers/scsi/libsas/sas_expander.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/libsas/sas_expander.c +1 -1
index ab671cdd4cfb..b7d1b1ea185d 100644
@@ -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)
Signature · 1 line
2.27.0
#2 lore raw
In reply to Colin King
Quoted 3 lines · Colin King

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
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering