scsi: libcxgbi: remove uninitialized variable len
authorColin Ian King <colin.king@canonical.com>
Sat, 16 Mar 2019 22:57:09 +0000 (22:57 +0000)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 28 Mar 2019 00:56:35 +0000 (20:56 -0400)
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>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/cxgbi/libcxgbi.c

index 006372b3fba20eaf5e91b5d0c7c0d0ae084fac2d..1d91154845038e7f02e7bc215445ce972d9e5182 100644 (file)
@@ -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);