diff mbox series

[12/25] PCI: Converge return paths in __assign_resources_sorted()

Message ID 20241216175632.4175-13-ilpo.jarvinen@linux.intel.com (mailing list archive)
State New
Delegated to: Bjorn Helgaas
Headers show
Series PCI: Resource fitting/assignment fixes and cleanups | expand

Commit Message

Ilpo Järvinen Dec. 16, 2024, 5:56 p.m. UTC
All return paths want to free head list in __assign_resources_sorted()
so add a label and use goto.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/pci/setup-bus.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 6b4318da1147..ad7bc6166b23 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -444,8 +444,7 @@  static void __assign_resources_sorted(struct list_head *head,
 		list_for_each_entry(dev_res, head, list)
 			remove_from_list(realloc_head, dev_res->res);
 		free_list(&save_head);
-		free_list(head);
-		return;
+		goto out;
 	}
 
 	/* Check failed type */
@@ -488,6 +487,8 @@  static void __assign_resources_sorted(struct list_head *head,
 	/* Try to satisfy any additional optional resource requests */
 	if (realloc_head)
 		reassign_resources_sorted(realloc_head, head);
+
+out:
 	free_list(head);
 }