]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blobdiff - drivers/scsi/scsi_transport_sas.c
scsi: scsi_transport_sas: Fix memory leak when removing devices
[mirror_ubuntu-eoan-kernel.git] / drivers / scsi / scsi_transport_sas.c
index ef138c57e2a6b3bab78cf38e44237ebf2416445c..182fd25c7c43fa286d757b8128b33a60abce3cfe 100644 (file)
@@ -1391,9 +1391,6 @@ static void sas_expander_release(struct device *dev)
        struct sas_rphy *rphy = dev_to_rphy(dev);
        struct sas_expander_device *edev = rphy_to_expander_device(rphy);
 
-       if (rphy->q)
-               blk_cleanup_queue(rphy->q);
-
        put_device(dev->parent);
        kfree(edev);
 }
@@ -1403,9 +1400,6 @@ static void sas_end_device_release(struct device *dev)
        struct sas_rphy *rphy = dev_to_rphy(dev);
        struct sas_end_device *edev = rphy_to_end_device(rphy);
 
-       if (rphy->q)
-               blk_cleanup_queue(rphy->q);
-
        put_device(dev->parent);
        kfree(edev);
 }
@@ -1634,8 +1628,7 @@ sas_rphy_remove(struct sas_rphy *rphy)
        }
 
        sas_rphy_unlink(rphy);
-       if (rphy->q)
-               bsg_unregister_queue(rphy->q);
+       bsg_remove_queue(rphy->q);
        transport_remove_device(dev);
        device_del(dev);
 }