Skip to content

Commit

Permalink
firmware: dmi_scan: Clarify dmi_save_extended_devices
Browse files Browse the repository at this point in the history
Get rid of the arbitrary 5-byte pointer offset, it served no purpose
and made it harder to match the code with the SMBIOS specification.

Signed-off-by: Jean Delvare <[email protected]>
Cc: Jordan Hargrave <[email protected]>
Cc: Narendra K <[email protected]>
  • Loading branch information
jdelvare committed Jan 15, 2016
1 parent 96e2394 commit 45b9825
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions drivers/firmware/dmi_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,16 +346,15 @@ static void __init dmi_save_dev_onboard(int instance, int segment, int bus,
static void __init dmi_save_extended_devices(const struct dmi_header *dm)
{
const char *name;
const u8 *d = (u8 *) dm + 5;
const u8 *d = (u8 *)dm;

/* Skip disabled device */
if ((*d & 0x80) == 0)
if ((d[0x5] & 0x80) == 0)
return;

name = dmi_string_nosave(dm, *(d - 1));
dmi_save_dev_onboard(*(d+1), *(u16 *)(d+2), *(d+4), *(d+5),
name);
dmi_save_one_device(*d & 0x7f, name);
name = dmi_string_nosave(dm, d[0x4]);
dmi_save_dev_onboard(d[0x6], *(u16 *)(d + 0x7), d[0x9], d[0xA], name);
dmi_save_one_device(d[0x5] & 0x7f, name);
}

static void __init count_mem_devices(const struct dmi_header *dm, void *v)
Expand Down

0 comments on commit 45b9825

Please sign in to comment.