Skip to content

Commit 1eaff53

Browse files
hiss2018martinkpetersen
authored andcommitted
scsi: lpfc: Add missing misc_deregister() for lpfc_init()
lpfc_init() misses a call misc_deregister() in an error path. Add a label 'unregister' to fix it. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: James Smart <[email protected]> Signed-off-by: Jing Xiangfeng <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent af6de8c commit 1eaff53

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/scsi/lpfc/lpfc_init.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14099,17 +14099,18 @@ lpfc_init(void)
1409914099
printk(KERN_ERR "Could not register lpfcmgmt device, "
1410014100
"misc_register returned with status %d", error);
1410114101

14102+
error = -ENOMEM;
1410214103
lpfc_transport_functions.vport_create = lpfc_vport_create;
1410314104
lpfc_transport_functions.vport_delete = lpfc_vport_delete;
1410414105
lpfc_transport_template =
1410514106
fc_attach_transport(&lpfc_transport_functions);
1410614107
if (lpfc_transport_template == NULL)
14107-
return -ENOMEM;
14108+
goto unregister;
1410814109
lpfc_vport_transport_template =
1410914110
fc_attach_transport(&lpfc_vport_transport_functions);
1411014111
if (lpfc_vport_transport_template == NULL) {
1411114112
fc_release_transport(lpfc_transport_template);
14112-
return -ENOMEM;
14113+
goto unregister;
1411314114
}
1411414115
lpfc_nvme_cmd_template();
1411514116
lpfc_nvmet_cmd_template();
@@ -14135,6 +14136,8 @@ lpfc_init(void)
1413514136
cpuhp_failure:
1413614137
fc_release_transport(lpfc_transport_template);
1413714138
fc_release_transport(lpfc_vport_transport_template);
14139+
unregister:
14140+
misc_deregister(&lpfc_mgmt_dev);
1413814141

1413914142
return error;
1414014143
}

0 commit comments

Comments
 (0)