s390/pci: cleanup resources only if necessary
authorNiklas Schnelle <schnelle@linux.ibm.com>
Fri, 6 Aug 2021 08:28:40 +0000 (10:28 +0200)
committerHeiko Carstens <hca@linux.ibm.com>
Wed, 25 Aug 2021 09:03:32 +0000 (11:03 +0200)
It's currently safe to call zpci_cleanup_bus_resources() even if the
resources were never created but it makes no sense so check
zdev->has_resources before we call zpci_cleanup_bus_resources() in
zpci_release_device().

Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Acked-by: Pierre Morel <pmorel@linux.ibm.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/pci/pci.c

index a678b9db56e5d0e7830d0bb2205b2b9e797d0a2c..67dc5b1379c171449043031efe07ed52dabdc35e 100644 (file)
@@ -822,7 +822,8 @@ void zpci_release_device(struct kref *kref)
        case ZPCI_FN_STATE_STANDBY:
                if (zdev->has_hp_slot)
                        zpci_exit_slot(zdev);
-               zpci_cleanup_bus_resources(zdev);
+               if (zdev->has_resources)
+                       zpci_cleanup_bus_resources(zdev);
                zpci_bus_device_unregister(zdev);
                zpci_destroy_iommu(zdev);
                fallthrough;