[coreboot] [PATCH] Use die() properly
Carl-Daniel Hailfinger
c-d.hailfinger.devel.2006 at gmx.net
Fri Jun 5 13:19:34 CEST 2009
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 at gmx.net>
Index: LinuxBIOSv2-die/src/console/console.c
===================================================================
--- LinuxBIOSv2-die/src/console/console.c (Revision 4339)
+++ LinuxBIOSv2-die/src/console/console.c (Arbeitskopie)
@@ -92,7 +92,7 @@
}
/* Report a fatal error */
-void die(const char *msg)
+void __attribute__((noreturn)) die(const char *msg)
{
printk_emerg("%s", msg);
post_code(0xff);
Index: LinuxBIOSv2-die/src/devices/smbus_ops.c
===================================================================
--- LinuxBIOSv2-die/src/devices/smbus_ops.c (Revision 4339)
+++ LinuxBIOSv2-die/src/devices/smbus_ops.c (Arbeitskopie)
@@ -34,7 +34,6 @@
if (!pbus || !pbus->dev || !pbus->dev->ops || !pbus->dev->ops->ops_smbus_bus) {
printk_alert("%s Cannot find smbus bus operations", dev_path(dev));
die("");
- for(;;);
}
return pbus;
}
Index: LinuxBIOSv2-die/src/devices/pci_ops.c
===================================================================
--- LinuxBIOSv2-die/src/devices/pci_ops.c (Revision 4339)
+++ LinuxBIOSv2-die/src/devices/pci_ops.c (Arbeitskopie)
@@ -30,7 +30,7 @@
struct bus *pbus;
if (!dev)
- printk_alert("get_pbus: dev is NULL!\n");
+ die("get_pbus: dev is NULL!\n");
pbus = dev->bus;
@@ -44,9 +44,8 @@
pbus = pbus->dev->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("");
- for(;;);
}
return pbus;
}
Index: LinuxBIOSv2-die/src/southbridge/intel/i82801dbm/i82801dbm_lpc.c
===================================================================
--- LinuxBIOSv2-die/src/southbridge/intel/i82801dbm/i82801dbm_lpc.c (Revision 4339)
+++ LinuxBIOSv2-die/src/southbridge/intel/i82801dbm/i82801dbm_lpc.c (Arbeitskopie)
@@ -37,12 +37,12 @@
dword=*ioapic_sbd;
printk_debug("Southbridge apic id = %x\n",dword);
if(dword!=(2<<24))
- for(;;);
+ die("");
//lyh *ioapic_sba=3;
//lyh dword=*ioapic_sbd;
//lyh printk_debug("Southbridge apic DT = %x\n",dword);
//lyh if(dword!=1)
- //lyh for(;;);
+ //lyh die("");
}
--
http://www.hailfinger.org/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: linuxbios_die.diff
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20090605/96bc7036/attachment.ksh>
More information about the coreboot
mailing list