Author: hailfinger
Date: 2009-06-05 13:41:51 +0200 (Fri, 05 Jun 2009)
New Revision: 4340

Modified:
   trunk/coreboot-v2/src/console/console.c
   trunk/coreboot-v2/src/devices/pci_ops.c
   trunk/coreboot-v2/src/devices/smbus_ops.c
   trunk/coreboot-v2/src/southbridge/intel/i82801dbm/i82801dbm_lpc.c
Log:
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 <[email protected]>
Acked-by: Peter Stuge <[email protected]>


Modified: trunk/coreboot-v2/src/console/console.c
===================================================================
--- trunk/coreboot-v2/src/console/console.c     2009-06-05 10:00:07 UTC (rev 
4339)
+++ trunk/coreboot-v2/src/console/console.c     2009-06-05 11:41:51 UTC (rev 
4340)
@@ -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);

Modified: trunk/coreboot-v2/src/devices/pci_ops.c
===================================================================
--- trunk/coreboot-v2/src/devices/pci_ops.c     2009-06-05 10:00:07 UTC (rev 
4339)
+++ trunk/coreboot-v2/src/devices/pci_ops.c     2009-06-05 11:41:51 UTC (rev 
4340)
@@ -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;
 }

Modified: trunk/coreboot-v2/src/devices/smbus_ops.c
===================================================================
--- trunk/coreboot-v2/src/devices/smbus_ops.c   2009-06-05 10:00:07 UTC (rev 
4339)
+++ trunk/coreboot-v2/src/devices/smbus_ops.c   2009-06-05 11:41:51 UTC (rev 
4340)
@@ -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;
 }

Modified: trunk/coreboot-v2/src/southbridge/intel/i82801dbm/i82801dbm_lpc.c
===================================================================
--- trunk/coreboot-v2/src/southbridge/intel/i82801dbm/i82801dbm_lpc.c   
2009-06-05 10:00:07 UTC (rev 4339)
+++ trunk/coreboot-v2/src/southbridge/intel/i82801dbm/i82801dbm_lpc.c   
2009-06-05 11:41:51 UTC (rev 4340)
@@ -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("");
 
 
 }


-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to