summaryrefslogtreecommitdiffstats
path: root/drivers/firmware/dmi_scan.c
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2016-01-15 22:08:44 +0100
committerJean Delvare <jdelvare@suse.de>2016-01-15 22:08:44 +0100
commit45b9825708198311cbe00daf9d1a40098c12c45b (patch)
tree588ad740ea6a837b56271d7befc801bb8c9ad23f /drivers/firmware/dmi_scan.c
parentfirmware: dmi_scan: Optimize dmi_save_extended_devices (diff)
downloadlinux-45b9825708198311cbe00daf9d1a40098c12c45b.tar.xz
linux-45b9825708198311cbe00daf9d1a40098c12c45b.zip
firmware: dmi_scan: Clarify dmi_save_extended_devices
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 <jdelvare@suse.de> Cc: Jordan Hargrave <jordan_hargrave@dell.com> Cc: Narendra K <narendra_k@dell.com>
Diffstat (limited to 'drivers/firmware/dmi_scan.c')
-rw-r--r--drivers/firmware/dmi_scan.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 28b2f0af35fd..ce666ef24bdc 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -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)