scsi: mpt3sas: Fix in error path
authorTomas Henzl <thenzl@redhat.com>
Sun, 15 Oct 2023 11:45:29 +0000 (13:45 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 17 Oct 2023 01:04:54 +0000 (21:04 -0400)
The driver should be deregistered as misc driver after PCI registration
failure.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Link: https://lore.kernel.org/r/20231015114529.10725-1-thenzl@redhat.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mpt3sas/mpt3sas_scsih.c

index c3c1f46..605013d 100644 (file)
@@ -12913,8 +12913,10 @@ _mpt3sas_init(void)
        mpt3sas_ctl_init(hbas_to_enumerate);
 
        error = pci_register_driver(&mpt3sas_driver);
-       if (error)
+       if (error) {
+               mpt3sas_ctl_exit(hbas_to_enumerate);
                scsih_exit();
+       }
 
        return error;
 }