die() does never return. Annotate it as such.

Any endless loop after die() can be eliminated.
Dereferencing a NULL pointer is bad. die() instead.
Replace endless loops with die().

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Peter Stuge <peter@stuge.se>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4340 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Carl-Daniel Hailfinger 2009-06-05 11:41:51 +00:00
parent 28d71b9445
commit 87e7050bff
4 changed files with 5 additions and 7 deletions

View File

@ -92,7 +92,7 @@ void post_code(uint8_t value)
} }
/* Report a fatal error */ /* Report a fatal error */
void die(const char *msg) void __attribute__((noreturn)) die(const char *msg)
{ {
printk_emerg("%s", msg); printk_emerg("%s", msg);
post_code(0xff); post_code(0xff);

View File

@ -30,7 +30,7 @@ static struct bus *get_pbus(device_t dev)
struct bus *pbus; struct bus *pbus;
if (!dev) if (!dev)
printk_alert("get_pbus: dev is NULL!\n"); die("get_pbus: dev is NULL!\n");
pbus = dev->bus; pbus = dev->bus;
@ -44,9 +44,8 @@ static struct bus *get_pbus(device_t dev)
pbus = pbus->dev->bus; pbus = pbus->dev->bus;
} }
if (!pbus || !pbus->dev || !pbus->dev->ops || !pbus->dev->ops->ops_pci_bus) { if (!pbus || !pbus->dev || !pbus->dev->ops || !pbus->dev->ops->ops_pci_bus) {
printk_alert("%s Cannot find pci bus operations", dev_path(dev)); printk_emerg("%s Cannot find pci bus operations\n", dev_path(dev));
die(""); die("");
for(;;);
} }
return pbus; return pbus;
} }

View File

@ -34,7 +34,6 @@ struct bus *get_pbus_smbus(device_t dev)
if (!pbus || !pbus->dev || !pbus->dev->ops || !pbus->dev->ops->ops_smbus_bus) { if (!pbus || !pbus->dev || !pbus->dev->ops || !pbus->dev->ops->ops_smbus_bus) {
printk_alert("%s Cannot find smbus bus operations", dev_path(dev)); printk_alert("%s Cannot find smbus bus operations", dev_path(dev));
die(""); die("");
for(;;);
} }
return pbus; return pbus;
} }

View File

@ -37,12 +37,12 @@ void i82801dbm_enable_ioapic( struct device *dev)
dword=*ioapic_sbd; dword=*ioapic_sbd;
printk_debug("Southbridge apic id = %x\n",dword); printk_debug("Southbridge apic id = %x\n",dword);
if(dword!=(2<<24)) if(dword!=(2<<24))
for(;;); die("");
//lyh *ioapic_sba=3; //lyh *ioapic_sba=3;
//lyh dword=*ioapic_sbd; //lyh dword=*ioapic_sbd;
//lyh printk_debug("Southbridge apic DT = %x\n",dword); //lyh printk_debug("Southbridge apic DT = %x\n",dword);
//lyh if(dword!=1) //lyh if(dword!=1)
//lyh for(;;); //lyh die("");
} }