From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: skashyap@marvell.com, jhasan@marvell.com,
GR-QLogic-Storage-Upstream@marvell.com, jejb@linux.ibm.com,
martin.petersen@oracle.com, chad.dupuis@cavium.com,
arun.easi@cavium.com, nilesh.javali@cavium.com
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Subject: [PATCH 1/3] scsi: qedf: Fix an error handling path in 'qedf_alloc_global_queues()'
Date: Sun, 23 May 2021 13:02:29 +0200 [thread overview]
Message-ID: <4c9c67bcad414c1128d26fceb9d6b579cb39cdc9.1621765056.git.christophe.jaillet@wanadoo.fr> (raw)
In-Reply-To: <cover.1621765056.git.christophe.jaillet@wanadoo.fr>
If 'qedf_alloc_bdq()' fails, 'status' is known to be 0, so we report
success to the caller.
In fact going to 'mem_alloc_failure' is pointless here, because we try to
free some resources that have not been allocated yet.
This is however harmless because 'qedf_free_global_queues()' is robust
enough.
So make a direct return instead, as already done just a few lines above.
While at it, also do a direct return if '!qedf->p_cpuq'. Going to
'mem_alloc_failure' is also pointless here and mixing goto and direct
return is spurious. So make it clear that nothing has to be undone.
Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/scsi/qedf/qedf_main.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index 7368a40ba649..ff3a1b183a7c 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -3022,9 +3022,8 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf)
* addresses of our queues
*/
if (!qedf->p_cpuq) {
- status = 1;
QEDF_ERR(&qedf->dbg_ctx, "p_cpuq is NULL.\n");
- goto mem_alloc_failure;
+ return 1;
}
qedf->global_queues = kzalloc((sizeof(struct global_queue *)
@@ -3041,7 +3040,7 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf)
rc = qedf_alloc_bdq(qedf);
if (rc) {
QEDF_ERR(&qedf->dbg_ctx, "Unable to allocate bdq.\n");
- goto mem_alloc_failure;
+ return -ENOMEM;
}
/* Allocate a CQ and an associated PBL for each MSI-X vector */
--
2.30.2
next prev parent reply other threads:[~2021-05-23 11:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-23 11:01 [PATCH 0/3] scsi: qedf: Fix an error handling path + cleanups Christophe JAILLET
2021-05-23 11:02 ` Christophe JAILLET [this message]
2021-05-23 11:02 ` [PATCH 2/3] scsi: qedf: Simplify 'qedf_alloc_global_queues()' Christophe JAILLET
2021-05-23 11:02 ` [PATCH 3/3] scsi: qedf: Axe a few useless lines of code Christophe JAILLET
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=4c9c67bcad414c1128d26fceb9d6b579cb39cdc9.1621765056.git.christophe.jaillet@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=GR-QLogic-Storage-Upstream@marvell.com \
--cc=arun.easi@cavium.com \
--cc=chad.dupuis@cavium.com \
--cc=jejb@linux.ibm.com \
--cc=jhasan@marvell.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=nilesh.javali@cavium.com \
--cc=skashyap@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;
as well as URLs for NNTP newsgroup(s).