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@xxxxxxxxxx> --- 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