From: Dan Carpenter <dan.carpenter@oracle.com>
To: Nilesh Javali <njavali@marvell.com>,
Manish Rangankar <manish.rangankar@cavium.com>
Cc: GR-QLogic-Storage-Upstream@marvell.com,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Hannes Reinecke <hare@suse.de>, Arun Easi <arun.easi@cavium.com>,
Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>,
Johannes Thumshirn <jthumshirn@suse.de>,
linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/2] scsi: qedi: Fix error codes in qedi_alloc_global_queues()
Date: Tue, 10 Aug 2021 11:47:53 +0300 [thread overview]
Message-ID: <20210810084753.GD23810@kili> (raw)
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.
Fixes: ace7f46ba5fd ("scsi: qedi: Add QLogic FastLinQ offload iSCSI driver framework.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/scsi/qedi/qedi_main.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index 0b0acb827071..e6dc0b495a82 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -1621,7 +1621,7 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi)
{
u32 *list;
int i;
- int status = 0, rc;
+ int status;
u32 *pbl;
dma_addr_t page;
int num_pages;
@@ -1632,14 +1632,14 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi)
*/
if (!qedi->num_queues) {
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
* addresses of our queues
*/
if (!qedi->p_cpuq) {
- status = 1;
+ status = -EINVAL;
goto mem_alloc_failure;
}
@@ -1654,13 +1654,13 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi)
"qedi->global_queues=%p.\n", qedi->global_queues);
/* Allocate DMA coherent buffers for BDQ */
- rc = qedi_alloc_bdq(qedi);
- if (rc)
+ status = qedi_alloc_bdq(qedi);
+ if (status)
goto mem_alloc_failure;
/* Allocate DMA coherent buffers for NVM_ISCSI_CFG */
- rc = qedi_alloc_nvm_iscsi_cfg(qedi);
- if (rc)
+ status = qedi_alloc_nvm_iscsi_cfg(qedi);
+ if (status)
goto mem_alloc_failure;
/* Allocate a CQ and an associated PBL for each MSI-X
--
2.20.1
next reply other threads:[~2021-08-10 8:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-10 8:47 Dan Carpenter [this message]
2021-08-10 8:51 ` [PATCH 2/2] scsi: qedf: fix error codes in qedf_alloc_global_queues() Dan Carpenter
2021-08-13 8:47 ` [EXT] [PATCH 1/2] scsi: qedi: Fix error codes in qedi_alloc_global_queues() Manish Rangankar
2021-08-16 17:28 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210810084753.GD23810@kili \
--to=dan.carpenter@oracle.com \
--cc=GR-QLogic-Storage-Upstream@marvell.com \
--cc=adheer.chandravanshi@qlogic.com \
--cc=arun.easi@cavium.com \
--cc=hare@suse.de \
--cc=jejb@linux.ibm.com \
--cc=jthumshirn@suse.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=manish.rangankar@cavium.com \
--cc=martin.petersen@oracle.com \
--cc=njavali@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox