scsi: lpfc: Fix nvme allocation bug on failed nvme_fc_register_localport
authorJames Smart <jsmart2021@gmail.com>
Sat, 4 Mar 2017 17:30:29 +0000 (09:30 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 7 Mar 2017 04:04:22 +0000 (23:04 -0500)
nvme bufs get allocated even when the registration fails.
Move allocation into the rsgistration success path.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_nvme.c

index e1bf31e..26cde7c 100644 (file)
@@ -2164,10 +2164,10 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport)
                lport->vport = vport;
                INIT_LIST_HEAD(&lport->rport_list);
                vport->nvmei_support = 1;
+               len  = lpfc_new_nvme_buf(vport, phba->sli4_hba.nvme_xri_max);
+               vport->phba->total_nvme_bufs += len;
        }
 
-       len  = lpfc_new_nvme_buf(vport, phba->sli4_hba.nvme_xri_max);
-       vport->phba->total_nvme_bufs += len;
        return ret;
 }