Skip to content

Commit

Permalink
scsi: lpfc: Add missing misc_deregister() for lpfc_init()
Browse files Browse the repository at this point in the history
lpfc_init() misses a call misc_deregister() in an error path. Add a label
'unregister' to fix it.

Link: https://lore.kernel.org/r/20200731065639.190646-1-jingxiangfeng@huawei.com
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Jing Xiangfeng authored and Martin K. Petersen committed Aug 5, 2020
1 parent af6de8c commit 1eaff53
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/scsi/lpfc/lpfc_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -14099,17 +14099,18 @@ lpfc_init(void)
printk(KERN_ERR "Could not register lpfcmgmt device, "
"misc_register returned with status %d", error);

error = -ENOMEM;
lpfc_transport_functions.vport_create = lpfc_vport_create;
lpfc_transport_functions.vport_delete = lpfc_vport_delete;
lpfc_transport_template =
fc_attach_transport(&lpfc_transport_functions);
if (lpfc_transport_template == NULL)
return -ENOMEM;
goto unregister;
lpfc_vport_transport_template =
fc_attach_transport(&lpfc_vport_transport_functions);
if (lpfc_vport_transport_template == NULL) {
fc_release_transport(lpfc_transport_template);
return -ENOMEM;
goto unregister;
}
lpfc_nvme_cmd_template();
lpfc_nvmet_cmd_template();
Expand All @@ -14135,6 +14136,8 @@ lpfc_init(void)
cpuhp_failure:
fc_release_transport(lpfc_transport_template);
fc_release_transport(lpfc_vport_transport_template);
unregister:
misc_deregister(&lpfc_mgmt_dev);

return error;
}
Expand Down

0 comments on commit 1eaff53

Please sign in to comment.