diff options
author | Bart Van Assche <bvanassche@acm.org> | 2019-04-04 12:44:47 -0700 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2019-04-08 22:16:34 -0400 |
commit | 59c209a689a66190e6eba7286e9be18ddb3df85b (patch) | |
tree | 4dbc9006b3e952155587cad0bdcbdd168c693ab8 /drivers/scsi | |
parent | c794d24ec9eb6658909955772e70f34bef5b5b91 (diff) | |
download | linux-59c209a689a66190e6eba7286e9be18ddb3df85b.tar.bz2 |
scsi: qla2xxx: Unregister resources in the opposite order of the registration order
Make sure that resources are only unregistered after the users of these
resources have been unregistered. Only unregister the character device if
registration of it succeeded.
Cc: Himanshu Madhani <hmadhani@marvell.com>
Cc: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index ea0b666c3c90..b0e5484bf026 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -7407,14 +7407,15 @@ destroy_cache: static void __exit qla2x00_module_exit(void) { - unregister_chrdev(apidev_major, QLA2XXX_APIDEV); pci_unregister_driver(&qla2xxx_pci_driver); qla2x00_release_firmware(); - kmem_cache_destroy(srb_cachep); - qlt_exit(); kmem_cache_destroy(ctx_cachep); - fc_release_transport(qla2xxx_transport_template); fc_release_transport(qla2xxx_transport_vport_template); + if (apidev_major >= 0) + unregister_chrdev(apidev_major, QLA2XXX_APIDEV); + fc_release_transport(qla2xxx_transport_template); + qlt_exit(); + kmem_cache_destroy(srb_cachep); } module_init(qla2x00_module_init); |