Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 80083
b: refs/heads/master
c: 79da472
h: refs/heads/master
i:
  80081: 09aa4f4
  80079: c649853
v: v3
  • Loading branch information
Parag Warudkar authored and Ingo Molnar committed Jan 30, 2008
1 parent 7050145 commit d9ddb19
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aca46ba29298810b329518b96f97ace985027b59
refs/heads/master: 79da4721117fcf188b4b007b775738a530f574da
24 changes: 21 additions & 3 deletions trunk/drivers/firmware/dmi_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <linux/slab.h>
#include <asm/dmi.h>

static char dmi_empty_string[] = " ";

static char * __init dmi_string(const struct dmi_header *dm, u8 s)
{
const u8 *bp = ((u8 *) dm) + dm->length;
Expand All @@ -21,11 +23,16 @@ static char * __init dmi_string(const struct dmi_header *dm, u8 s)
}

if (*bp != 0) {
str = dmi_alloc(strlen(bp) + 1);
size_t len = strlen(bp)+1;
size_t cmp_len = len > 8 ? 8 : len;

if (!memcmp(bp, dmi_empty_string, cmp_len))
return dmi_empty_string;
str = dmi_alloc(len);
if (str != NULL)
strcpy(str, bp);
else
printk(KERN_ERR "dmi_string: out of memory.\n");
printk(KERN_ERR "dmi_string: cannot allocate %Zu bytes.\n", len);
}
}

Expand Down Expand Up @@ -175,12 +182,23 @@ static void __init dmi_save_devices(const struct dmi_header *dm)
}
}

static struct dmi_device empty_oem_string_dev = {
.name = dmi_empty_string,
};

static void __init dmi_save_oem_strings_devices(const struct dmi_header *dm)
{
int i, count = *(u8 *)(dm + 1);
struct dmi_device *dev;

for (i = 1; i <= count; i++) {
char *devname = dmi_string(dm, i);

if (!strcmp(devname, dmi_empty_string)) {
list_add(&empty_oem_string_dev.list, &dmi_devices);
continue;
}

dev = dmi_alloc(sizeof(*dev));
if (!dev) {
printk(KERN_ERR
Expand All @@ -189,7 +207,7 @@ static void __init dmi_save_oem_strings_devices(const struct dmi_header *dm)
}

dev->type = DMI_DEV_TYPE_OEM_STRING;
dev->name = dmi_string(dm, i);
dev->name = devname;
dev->device_data = NULL;

list_add(&dev->list, &dmi_devices);
Expand Down

0 comments on commit d9ddb19

Please sign in to comment.