summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMyles Watson <mylesgw@gmail.com>2009-10-29 21:27:43 +0000
committerMyles Watson <mylesgw@gmail.com>2009-10-29 21:27:43 +0000
commit8f6354b6d3d00a7041f3c770569e797da74acd04 (patch)
tree7da143b6965781b66b31fa258b66197ec9e728a0
parentdc4ca9a5dea9024bf17057dd78f58520183b2257 (diff)
Split a print statement that called dev_path twice, and add a warning comment.
Signed-off-by: Myles Watson <mylesgw@gmail.com> Acked-by: Myles Watson <mylesgw@gmail.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4889 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
-rw-r--r--src/devices/device_util.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/devices/device_util.c b/src/devices/device_util.c
index 71cd436f0c..a730556593 100644
--- a/src/devices/device_util.c
+++ b/src/devices/device_util.c
@@ -149,6 +149,8 @@ struct device *dev_find_class(unsigned int class, struct device *from)
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 *dev_path(device_t dev)
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 @@ static void resource_tree(struct device *root, int debug_level, int depth)
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",