Skip to content

Commit ada8b67

Browse files
Lorenzo Pieralisibjorn-helgaas
authored andcommitted
ARM/PCI: Replace panic with WARN messages on failures
In the ARM PCI bios32 layer, failures to dynamically allocate pci_sys_data for a PCI bus, or a PCI bus scan failure have to be considered serious warnings but they should not trigger a system panic so that at least the system is given a chance to be debugged. This patch replaces the panic statements with WARN() messages to improve error reporting in the ARM PCI bios32 layer. Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Jingoo Han <jingoohan1@gmail.com> Acked-by: Marc Zyngier <marc.zyngier@arm.com> CC: Russell King <linux@arm.linux.org.uk> CC: Marc Zyngier <marc.zyngier@arm.com>
1 parent aa4a5c0 commit ada8b67

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎arch/arm/kernel/bios32.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,8 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
459459

460460
for (nr = busnr = 0; nr < hw->nr_controllers; nr++) {
461461
sys = kzalloc(sizeof(struct pci_sys_data), GFP_KERNEL);
462-
if (!sys)
463-
panic("PCI: unable to allocate sys data!");
462+
if (WARN(!sys, "PCI: unable to allocate sys data!"))
463+
break;
464464

465465
#ifdef CONFIG_PCI_MSI
466466
sys->msi_ctrl = hw->msi_ctrl;
@@ -489,8 +489,10 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
489489
sys->bus = pci_scan_root_bus(parent, sys->busnr,
490490
hw->ops, sys, &sys->resources);
491491

492-
if (!sys->bus)
493-
panic("PCI: unable to scan bus!");
492+
if (WARN(!sys->bus, "PCI: unable to scan bus!")) {
493+
kfree(sys);
494+
break;
495+
}
494496

495497
busnr = sys->bus->busn_res.end + 1;
496498

0 commit comments

Comments
 (0)