Kyösti Mälkki ([email protected]) just uploaded a new patch set to 
gerrit, which you can find at http://review.coreboot.org/1626

-gerrit

commit ad4885f9bffc6bb182c22d0db32face42a41f45a
Author: Kyösti Mälkki <[email protected]>
Date:   Sun Oct 7 14:57:15 2012 +0200

    Take care of NULL chip_ops->name
    
    Change-Id: Ic44915cdb07e0d87962eff0744acefce2a4845a2
    Signed-off-by: Kyösti Mälkki <[email protected]>
---
 src/arch/x86/boot/smbios.c                    | 3 +--
 src/devices/device_util.c                     | 8 ++++++++
 src/drivers/generic/debug/debug_dev.c         | 7 +------
 src/include/device/device.h                   | 1 +
 src/mainboard/siemens/sitemp_g1p1/mainboard.c | 6 +++---
 5 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/arch/x86/boot/smbios.c b/src/arch/x86/boot/smbios.c
index a171707..ac0e132 100644
--- a/src/arch/x86/boot/smbios.c
+++ b/src/arch/x86/boot/smbios.c
@@ -278,8 +278,7 @@ static int smbios_walk_device_tree(device_t tree, int 
*handle, unsigned long *cu
        int len = 0;
 
        for(dev = tree; dev; dev = dev->next) {
-               printk(BIOS_INFO, "%s (%s)\n", dev_path(dev),
-                       (dev->chip_ops && dev->chip_ops->name) ? 
dev->chip_ops->name : "");
+               printk(BIOS_INFO, "%s (%s)\n", dev_path(dev), dev_name(dev));
 
                if (dev->ops && dev->ops->get_smbios_data)
                        len += dev->ops->get_smbios_data(dev, handle, current);
diff --git a/src/devices/device_util.c b/src/devices/device_util.c
index 6f088b2..5cf5eab 100644
--- a/src/devices/device_util.c
+++ b/src/devices/device_util.c
@@ -228,6 +228,14 @@ const char *dev_path(device_t dev)
        return buffer;
 }
 
+const char *dev_name(device_t dev)
+{
+       if (dev->chip_ops && dev->chip_ops->name)
+               return dev->chip_ops->name;
+       else
+               return "unknown";
+}
+
 const char *bus_path(struct bus *bus)
 {
        static char buffer[BUS_PATH_MAX];
diff --git a/src/drivers/generic/debug/debug_dev.c 
b/src/drivers/generic/debug/debug_dev.c
index 57f8077..b523ca7 100644
--- a/src/drivers/generic/debug/debug_dev.c
+++ b/src/drivers/generic/debug/debug_dev.c
@@ -237,12 +237,7 @@ static void debug_init(device_t dev)
        switch(dev->path.pnp.device) {
        case 0:
                parent = dev->bus->dev;
-               printk(BIOS_DEBUG, "DEBUG: %s", dev_path(parent));
-               if(parent->chip_ops && parent->chip_ops->name) {
-                       printk(BIOS_DEBUG, ": %s\n", parent->chip_ops->name);
-               } else {
-                       printk(BIOS_DEBUG, "\n");
-               }
+               printk(BIOS_DEBUG, "DEBUG: %s : %s\n", dev_path(parent), 
dev_name(parent));
                break;
 
        case 1:
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 642a4a6..7e07dc1 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -137,6 +137,7 @@ unsigned int scan_bus(struct device *bus, unsigned int max);
 void assign_resources(struct bus *bus);
 void enumerate_static_device(void);
 void enumerate_static_devices(void);
+const char *dev_name(device_t dev);
 const char *dev_path(device_t dev);
 const char *bus_path(struct bus *bus);
 void dev_set_enabled(device_t dev, int enable);
diff --git a/src/mainboard/siemens/sitemp_g1p1/mainboard.c 
b/src/mainboard/siemens/sitemp_g1p1/mainboard.c
index fd19a3b..f9c0eca 100644
--- a/src/mainboard/siemens/sitemp_g1p1/mainboard.c
+++ b/src/mainboard/siemens/sitemp_g1p1/mainboard.c
@@ -676,7 +676,7 @@ static void update_subsystemid( device_t dev )
        } else {
                dev->subsystem_device = 0x4077; // U1P0 = 0x4077
        }
-       printk(BIOS_INFO, "%s [%x/%x]\n", dev->chip_ops->name, 
dev->subsystem_vendor, dev->subsystem_device );
+       printk(BIOS_INFO, "%s [%x/%x]\n", dev_name(dev), dev->subsystem_vendor, 
dev->subsystem_device );
        for( i=0; slot[i].bus < 255; i++) {
                device_t d;
                d = dev_find_slot(slot[i].bus,slot[i].devfn);
@@ -812,7 +812,7 @@ static void init(device_t dev)
 #endif
 
        printk(BIOS_DEBUG, "%s %s[%x/%x] %s\n",
-               dev->chip_ops->name, dev_path(dev), dev->subsystem_vendor, 
dev->subsystem_device, __func__);
+               dev_name(dev), dev_path(dev), dev->subsystem_vendor, 
dev->subsystem_device, __func__);
 
 #if !CONFIG_PCI_OPTION_ROM_RUN_YABEL
        if(     get_option(&int15_func.regs.func00_LCD_panel_id, 
"lcd_panel_id") < 0 )
@@ -835,7 +835,7 @@ static void enable_dev(device_t dev)
 {
 
        printk(BIOS_INFO, "%s %s[%x/%x] %s\n",
-               dev->chip_ops->name, dev_path(dev), dev->subsystem_vendor, 
dev->subsystem_device, __func__);
+               dev_name(dev), dev_path(dev), dev->subsystem_vendor, 
dev->subsystem_device, __func__);
 #if CONFIG_PCI_OPTION_ROM_RUN_YABEL
        /* Install custom int15 handler for VGA OPROM */
        mainboard_interrupt_handlers(0x15, &int15_handler);

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

Reply via email to