PCI: Check resource_size() separately
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 16 Dec 2024 17:56:16 +0000 (19:56 +0200)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 18 Feb 2025 21:40:53 +0000 (15:40 -0600)
Instead of chaining logic inside if () condition so that multiple lines are
required, make !resource_size() a separate check and use continue.

Link: https://lore.kernel.org/r/20241216175632.4175-10-ilpo.jarvinen@linux.intel.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Xiaochun Lee <lixc17@lenovo.com>
drivers/pci/setup-bus.c

index 5f3215e0904d878fbb300102d157bcc6f5a29ea6..eaeaf09cd91d578f8b6d38d461fca3448ae9feb6 100644 (file)
@@ -285,8 +285,11 @@ static void assign_requested_resources_sorted(struct list_head *head,
        list_for_each_entry(dev_res, head, list) {
                res = dev_res->res;
                idx = res - &dev_res->dev->resource[0];
-               if (resource_size(res) &&
-                   pci_assign_resource(dev_res->dev, idx)) {
+
+               if (!resource_size(res))
+                       continue;
+
+               if (pci_assign_resource(dev_res->dev, idx)) {
                        if (fail_head) {
                                /*
                                 * If the failed resource is a ROM BAR and