Author: myles
Date: 2009-10-29 22:27:43 +0100 (Thu, 29 Oct 2009)
New Revision: 4889

Modified:
   trunk/coreboot-v2/src/devices/device_util.c
Log:
Split a print statement that called dev_path twice, and add a warning comment.

Signed-off-by: Myles Watson <myle...@gmail.com>
Acked-by: Myles Watson <myle...@gmail.com>



Modified: trunk/coreboot-v2/src/devices/device_util.c
===================================================================
--- trunk/coreboot-v2/src/devices/device_util.c 2009-10-29 16:49:50 UTC (rev 
4888)
+++ trunk/coreboot-v2/src/devices/device_util.c 2009-10-29 21:27:43 UTC (rev 
4889)
@@ -149,6 +149,8 @@
        return from;
 }
 
+/* Warning: This function uses a static buffer.  Don't call it more than once
+ * from the same print statement! */
 
 const char *dev_path(device_t dev)
 {
@@ -211,8 +213,7 @@
 const char *bus_path(struct bus *bus)
 {
        static char buffer[BUS_PATH_MAX];
-       sprintf(buffer, "%s,%d",
-               dev_path(bus->dev), bus->link);
+       sprintf(buffer, "%s,%d", dev_path(bus->dev), bus->link);
        return buffer;
 }
 
@@ -566,10 +567,10 @@
                indent[i] = ' ';
        indent[i] = '\0';
 
-       do_printk(BIOS_DEBUG, "%s%s links %x child on link 0 %s\n",
-                 indent, dev_path(root), root->links,
-                 root->link[0].children ? dev_path(root->link[0].children) :
-                                         "NULL");
+       do_printk(BIOS_DEBUG, "%s%s links %x child on link 0", indent,
+                 dev_path(root), root->links);
+       do_printk(BIOS_DEBUG, " %s\n", root->link[0].children ?
+                 dev_path(root->link[0].children) : "NULL");
        for (i = 0; i < root->resources; i++) {
                do_printk(BIOS_DEBUG,
                          "%s%s resource base %llx size %llx align %d gran %d 
limit %llx flags %lx index %lx\n",


-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to