From: Adrian Bunk Date: Fri, 17 Nov 2006 01:19:25 +0000 (+0100) Subject: PCI: ibmphp_pci.c: fix NULL dereference X-Git-Tag: v2.6.20-rc2~6^2~13^2~478^2~1 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=b0d974e90d6f9fbf3a926defbbc76543cff74426;p=linux-2.6-omap-h63xx.git PCI: ibmphp_pci.c: fix NULL dereference The correct order is: NULL check before dereference Spotted by the Coverity checker. Signed-off-by: Adrian Bunk Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c index d87a9e3eaee..d8f05d7a3c7 100644 --- a/drivers/pci/hotplug/ibmphp_pci.c +++ b/drivers/pci/hotplug/ibmphp_pci.c @@ -1371,12 +1371,12 @@ static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function) } bus = ibmphp_find_res_bus (sec_number); - debug ("bus->busno is %x\n", bus->busno); - debug ("sec_number is %x\n", sec_number); if (!bus) { err ("cannot find Bus structure for the bridged device\n"); return -EINVAL; } + debug("bus->busno is %x\n", bus->busno); + debug("sec_number is %x\n", sec_number); ibmphp_remove_bus (bus, busno);