* [PATCH] scsi: libcxgbi: remove uninitialized variable len
@ 2019-03-16 22:57 Colin King
2019-03-28 0:59 ` Martin K. Petersen
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2019-03-16 22:57 UTC (permalink / raw)
To: James E . J . Bottomley, Martin K . Petersen, David Ahern, linux-scsi
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The variable len is not being inintialized and the uninitialized
value is being returned. However, this return path is never reached
because the default case in the switch statement returns -ENOSYS.
Clean up the code by replacing the return -ENOSYS with a break
for the default case and returning -ENOSYS at the end of the
function. This allows len to be removed.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/scsi/cxgbi/libcxgbi.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index 006372b3fba2..1d9115484503 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -2310,7 +2310,6 @@ int cxgbi_get_ep_param(struct iscsi_endpoint *ep, enum iscsi_param param,
{
struct cxgbi_endpoint *cep = ep->dd_data;
struct cxgbi_sock *csk;
- int len;
log_debug(1 << CXGBI_DBG_ISCSI,
"cls_conn 0x%p, param %d.\n", ep, param);
@@ -2328,9 +2327,9 @@ int cxgbi_get_ep_param(struct iscsi_endpoint *ep, enum iscsi_param param,
return iscsi_conn_get_addr_param((struct sockaddr_storage *)
&csk->daddr, param, buf);
default:
- return -ENOSYS;
+ break;
}
- return len;
+ return -ENOSYS;
}
EXPORT_SYMBOL_GPL(cxgbi_get_ep_param);
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] scsi: libcxgbi: remove uninitialized variable len
2019-03-16 22:57 [PATCH] scsi: libcxgbi: remove uninitialized variable len Colin King
@ 2019-03-28 0:59 ` Martin K. Petersen
0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2019-03-28 0:59 UTC (permalink / raw)
To: Colin King
Cc: James E . J . Bottomley, Martin K . Petersen, David Ahern,
linux-scsi, kernel-janitors, linux-kernel
Colin,
> The variable len is not being inintialized and the uninitialized value
> is being returned. However, this return path is never reached because
> the default case in the switch statement returns -ENOSYS. Clean up
> the code by replacing the return -ENOSYS with a break for the default
> case and returning -ENOSYS at the end of the function. This allows
> len to be removed.
Not a fan of this ENOSYS business but I guess it's been that way
forever. Applied to 5.2/scsi-queue, thanks.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-28 1:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-16 22:57 [PATCH] scsi: libcxgbi: remove uninitialized variable len Colin King
2019-03-28 0:59 ` 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).