2021-03-27 23:13:48

by Colin King

[permalink] [raw]
Subject: [PATCH] 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")
Signed-off-by: Colin Ian King <[email protected]>
---
drivers/scsi/qedi/qedi_main.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index 69c5b5ee2169..2455d1448a7e 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -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;

--
2.30.2


2021-03-30 10:11:19

by Manish Rangankar

[permalink] [raw]
Subject: RE: [EXT] [PATCH] scsi: qedi: emove redundant assignment to variable err

> -----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")
> Signed-off-by: Colin Ian King <[email protected]>
> ---
> drivers/scsi/qedi/qedi_main.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c index
> 69c5b5ee2169..2455d1448a7e 100644
> --- a/drivers/scsi/qedi/qedi_main.c
> +++ b/drivers/scsi/qedi/qedi_main.c
> @@ -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;
>
> --
> 2.30.2

Thanks,
Acked-by: Manish Rangankar <[email protected]>

2021-04-02 03:55:23

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH] scsi: qedi: emove redundant assignment to variable err

On Sat, 27 Mar 2021 23:06:50 +0000, Colin King wrote:

> 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

--
Martin K. Petersen Oracle Linux Engineering