diff mbox series

[-next] scsi: lpfc: add missing destroy_workqueue() on error path in lpfc_sli4_driver_resource_setup()

Message ID 20220819085049.1906233-1-yangyingliang@huawei.com
State Superseded
Headers show
Series [-next] scsi: lpfc: add missing destroy_workqueue() on error path in lpfc_sli4_driver_resource_setup() | expand

Commit Message

Yang Yingliang Aug. 19, 2022, 8:50 a.m. UTC
Add the missing destroy_workqueue() before return from
lpfc_sli4_driver_resource_setup() in error path.

Fixes: 3cee98db2610 ("scsi: lpfc: Fix crash on driver unload in wq free")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/scsi/lpfc/lpfc_init.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

James Smart Aug. 22, 2022, 7:30 p.m. UTC | #1
On 8/19/2022 1:50 AM, Yang Yingliang wrote:
> Add the missing destroy_workqueue() before return from
> lpfc_sli4_driver_resource_setup() in error path.
> 
> Fixes: 3cee98db2610 ("scsi: lpfc: Fix crash on driver unload in wq free")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>   drivers/scsi/lpfc/lpfc_init.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
> index c69c5a0979ec..a7bb1620fbe1 100644
> --- a/drivers/scsi/lpfc/lpfc_init.c
> +++ b/drivers/scsi/lpfc/lpfc_init.c
> @@ -8053,7 +8053,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
>   	/* Allocate device driver memory */
>   	rc = lpfc_mem_alloc(phba, SGL_ALIGN_SZ);
>   	if (rc)
> -		return -ENOMEM;
> +		goto out_destory_workqueue;
>   
>   	/* IF Type 2 ports get initialized now. */
>   	if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >=
> @@ -8481,6 +8481,9 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
>   	lpfc_destroy_bootstrap_mbox(phba);
>   out_free_mem:
>   	lpfc_mem_free(phba);
> +out_destory_workqueue:
> +	destroy_workqueue(phba->wq);
> +	phba->wq = NULL;
>   	return rc;
>   }
>   

Looks fine
but label needs spelling error corrected: out_destroy_workqueue

Please resend with this fixed

-- james
diff mbox series

Patch

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index c69c5a0979ec..a7bb1620fbe1 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -8053,7 +8053,7 @@  lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
 	/* Allocate device driver memory */
 	rc = lpfc_mem_alloc(phba, SGL_ALIGN_SZ);
 	if (rc)
-		return -ENOMEM;
+		goto out_destory_workqueue;
 
 	/* IF Type 2 ports get initialized now. */
 	if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >=
@@ -8481,6 +8481,9 @@  lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
 	lpfc_destroy_bootstrap_mbox(phba);
 out_free_mem:
 	lpfc_mem_free(phba);
+out_destory_workqueue:
+	destroy_workqueue(phba->wq);
+	phba->wq = NULL;
 	return rc;
 }