]> git.ipfire.org Git - thirdparty/linux.git/commit
PCI: WARN (not BUG()) when we fail to assign optional resources
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Sun, 11 May 2025 21:52:23 +0000 (00:52 +0300)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 2 Jun 2025 14:31:53 +0000 (09:31 -0500)
commitaf6e3defb11a1c67cd462485655b43b5d70524b1
treea91359de83ce910faedd1fb22e527733d65a1da8
parent1c8a0ed2043c30cee97facd1eb8cff88b6c7ea4a
PCI: WARN (not BUG()) when we fail to assign optional resources

Resource fitting/assignment code checks if there's a remainder in
add_list (aka. realloc_head in the inner functions) using BUG_ON().
This problem typically results in a mere PCI device resource assignment
failure which does not warrant using BUG_ON(). The machine could well
come up usable even if this condition occurs because the realloc_head
relates to resources which are optional anyway.

Change BUG_ON() to WARN_ON_ONCE() and free the list if it's not empty.

[bhelgaas: subject]
Reported-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/linux-pci/5f103643-5e1c-43c6-b8fe-9617d3b5447c@linaro.org
Link: https://lore.kernel.org/r/20250511215223.7131-1-ilpo.jarvinen@linux.intel.com
drivers/pci/setup-bus.c