Skip to contentSkip to conversation

scsi: qedi: emove redundant assignment to variable err

PATCH Applied Colin King 3 participants 3 messages Mar 27, 2021 – Apr 2, 2021

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 scsi: qedi: emove redundant assignment to variable err

From: Colin Ian King <[email protected]>

variable err is assigned -ENOMEM followed by an error return path via label err_udev that does not access the variable and returns with the -ENOMEM error return code. The assignment to err is redundant and can be removed.

Addresses-Coverity: ("Unused value")

---
 drivers/scsi/qedi/qedi_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/qedi/qedi_main.c +1 -3
index 69c5b5ee2169..2455d1448a7e 100644
@@ -276,10 +276,8 @@ static int qedi_alloc_uio_rings(struct qedi_ctx *qedi)
 	}
 
 	udev = kzalloc(sizeof(*udev), GFP_KERNEL);
-	if (!udev) {
-		rc = -ENOMEM;
+	if (!udev)
 		goto err_udev;
-	}
 
 	udev->uio_dev = -1;
 
Signature · 1 line
2.30.2
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 43 lines

-----Original Message-----
From: Colin King <[email protected]>
Sent: Sunday, March 28, 2021 4:37 AM
To: Nilesh Javali <[email protected]>; Manish Rangankar <[email protected]>; GR-QLogic-Storage-Upstream <GR-QLogic- [email protected]>; James E . J . Bottomley <[email protected]>; Martin K . Petersen <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: [EXT] [PATCH] scsi: qedi: emove redundant assignment to variable err

External Email

----------------------------------------------------------------------
From: Colin Ian King <[email protected]>

variable err is assigned -ENOMEM followed by an error return path via label err_udev that does not access the variable and returns with the -ENOMEM error return code. The assignment to err is redundant and can be removed.

Addresses-Coverity: ("Unused value")

---
 drivers/scsi/qedi/qedi_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/qedi/qedi_main.c index renamed from drivers/scsi/qedi/qedi_main.c +0 -0

69c5b5ee2169..2455d1448a7e 100644

drivers/scsi/qedi/qedi_main.c +1 -4
@@ -276,10 +276,8 @@ static int qedi_alloc_uio_rings(struct qedi_ctx *qedi)
 	}
 
 	udev = kzalloc(sizeof(*udev), GFP_KERNEL);
-	if (!udev) {
-		rc = -ENOMEM;
+	if (!udev)
 		goto err_udev;
-	}
 
 	udev->uio_dev = -1;
 
--
Quoted 1 line

2.30.2

Thanks,

#2 lore raw
In reply to Colin King
Quoted 4 lines · Colin King

variable err is assigned -ENOMEM followed by an error return path via label err_udev that does not access the variable and returns with the -ENOMEM error return code. The assignment to err is redundant and can be removed.

Applied to 5.13/scsi-queue, thanks!

[1/1] scsi: qedi: emove redundant assignment to variable err

      https://git.kernel.org/mkp/scsi/c/8dc602529681
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering