Commit 4dbe57d4 authored by Dan Carpenter's avatar Dan Carpenter Committed by Martin K. Petersen

scsi: qedi: Fix error codes in qedi_alloc_global_queues()

This function had some left over code that returned 1 on error instead
negative error codes.  Convert everything to use negative error codes.  The
caller treats all non-zero returns the same so this does not affect run
time.

A couple places set "rc" instead of "status" so those error paths ended up
returning success by mistake.  Get rid of the "rc" variable and use
"status" everywhere.

Remove the bogus "status = 0" initialization, as a future proofing measure
so the compiler will warn about uninitialized error codes.

Link: https://lore.kernel.org/r/20210810084753.GD23810@kili
Fixes: ace7f46b ("scsi: qedi: Add QLogic FastLinQ offload iSCSI driver framework.")
Acked-by: default avatarManish Rangankar <mrangankar@marvell.com>
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent d1f6581a
...@@ -1621,7 +1621,7 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi) ...@@ -1621,7 +1621,7 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi)
{ {
u32 *list; u32 *list;
int i; int i;
int status = 0, rc; int status;
u32 *pbl; u32 *pbl;
dma_addr_t page; dma_addr_t page;
int num_pages; int num_pages;
...@@ -1632,14 +1632,14 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi) ...@@ -1632,14 +1632,14 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi)
*/ */
if (!qedi->num_queues) { if (!qedi->num_queues) {
QEDI_ERR(&qedi->dbg_ctx, "No MSI-X vectors available!\n"); QEDI_ERR(&qedi->dbg_ctx, "No MSI-X vectors available!\n");
return 1; return -ENOMEM;
} }
/* Make sure we allocated the PBL that will contain the physical /* Make sure we allocated the PBL that will contain the physical
* addresses of our queues * addresses of our queues
*/ */
if (!qedi->p_cpuq) { if (!qedi->p_cpuq) {
status = 1; status = -EINVAL;
goto mem_alloc_failure; goto mem_alloc_failure;
} }
...@@ -1654,13 +1654,13 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi) ...@@ -1654,13 +1654,13 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi)
"qedi->global_queues=%p.\n", qedi->global_queues); "qedi->global_queues=%p.\n", qedi->global_queues);
/* Allocate DMA coherent buffers for BDQ */ /* Allocate DMA coherent buffers for BDQ */
rc = qedi_alloc_bdq(qedi); status = qedi_alloc_bdq(qedi);
if (rc) if (status)
goto mem_alloc_failure; goto mem_alloc_failure;
/* Allocate DMA coherent buffers for NVM_ISCSI_CFG */ /* Allocate DMA coherent buffers for NVM_ISCSI_CFG */
rc = qedi_alloc_nvm_iscsi_cfg(qedi); status = qedi_alloc_nvm_iscsi_cfg(qedi);
if (rc) if (status)
goto mem_alloc_failure; goto mem_alloc_failure;
/* Allocate a CQ and an associated PBL for each MSI-X /* Allocate a CQ and an associated PBL for each MSI-X
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment