mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 00:20:32 +00:00
scsi: qedf: Fix error codes in qedf_alloc_global_queues()
[ Upstream commitccc89737aa
] This driver has some left over "return 1" on failure style code mixed with "return negative error codes" style code. The caller doesn't care so we should just convert everything to return negative error codes. Then there was a problem that there were two variables used to store error codes which just resulted in confusion. If qedf_alloc_bdq() returned a negative error code, we accidentally returned success instead of propagating the error code. So get rid of the "rc" variable and use "status" every where. Also remove the "status = 0" initialization so that these sorts of bugs will be detected by the compiler in the future. Link: https://lore.kernel.org/r/20210810085023.GA23998@kili Fixes:61d8658b4a
("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.") Acked-by: Manish Rangankar <mrangankar@marvell.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
dc45777499
commit
1bc19e4062
1 changed files with 5 additions and 5 deletions
|
@ -3000,7 +3000,7 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf)
|
|||
{
|
||||
u32 *list;
|
||||
int i;
|
||||
int status = 0, rc;
|
||||
int status;
|
||||
u32 *pbl;
|
||||
dma_addr_t page;
|
||||
int num_pages;
|
||||
|
@ -3012,7 +3012,7 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf)
|
|||
*/
|
||||
if (!qedf->num_queues) {
|
||||
QEDF_ERR(&(qedf->dbg_ctx), "No MSI-X vectors available!\n");
|
||||
return 1;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3020,7 +3020,7 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf)
|
|||
* addresses of our queues
|
||||
*/
|
||||
if (!qedf->p_cpuq) {
|
||||
status = 1;
|
||||
status = -EINVAL;
|
||||
QEDF_ERR(&qedf->dbg_ctx, "p_cpuq is NULL.\n");
|
||||
goto mem_alloc_failure;
|
||||
}
|
||||
|
@ -3036,8 +3036,8 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf)
|
|||
"qedf->global_queues=%p.\n", qedf->global_queues);
|
||||
|
||||
/* Allocate DMA coherent buffers for BDQ */
|
||||
rc = qedf_alloc_bdq(qedf);
|
||||
if (rc) {
|
||||
status = qedf_alloc_bdq(qedf);
|
||||
if (status) {
|
||||
QEDF_ERR(&qedf->dbg_ctx, "Unable to allocate bdq.\n");
|
||||
goto mem_alloc_failure;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue