mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 06:00:52 +07:00
efi/apple-properties: use PROPERTY_ENTRY_U8_ARRAY_LEN
Let's switch to using PROPERTY_ENTRY_U8_ARRAY_LEN() to initialize property entries. Also, when dumping data, rely on local variables instead of poking into the property entry structure directly. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
1741cfacfa
commit
4466bf8282
@ -53,7 +53,8 @@ static void __init unmarshal_key_value_pairs(struct dev_header *dev_header,
|
|||||||
|
|
||||||
for (i = 0; i < dev_header->prop_count; i++) {
|
for (i = 0; i < dev_header->prop_count; i++) {
|
||||||
int remaining = dev_header->len - (ptr - (void *)dev_header);
|
int remaining = dev_header->len - (ptr - (void *)dev_header);
|
||||||
u32 key_len, val_len;
|
u32 key_len, val_len, entry_len;
|
||||||
|
const u8 *entry_data;
|
||||||
char *key;
|
char *key;
|
||||||
|
|
||||||
if (sizeof(key_len) > remaining)
|
if (sizeof(key_len) > remaining)
|
||||||
@ -85,17 +86,14 @@ static void __init unmarshal_key_value_pairs(struct dev_header *dev_header,
|
|||||||
ucs2_as_utf8(key, ptr + sizeof(key_len),
|
ucs2_as_utf8(key, ptr + sizeof(key_len),
|
||||||
key_len - sizeof(key_len));
|
key_len - sizeof(key_len));
|
||||||
|
|
||||||
entry[i].name = key;
|
entry_data = ptr + key_len + sizeof(val_len);
|
||||||
entry[i].length = val_len - sizeof(val_len);
|
entry_len = val_len - sizeof(val_len);
|
||||||
entry[i].is_array = !!entry[i].length;
|
entry[i] = PROPERTY_ENTRY_U8_ARRAY_LEN(key, entry_data,
|
||||||
entry[i].type = DEV_PROP_U8;
|
entry_len);
|
||||||
entry[i].pointer.u8_data = ptr + key_len + sizeof(val_len);
|
|
||||||
|
|
||||||
if (dump_properties) {
|
if (dump_properties) {
|
||||||
dev_info(dev, "property: %s\n", entry[i].name);
|
dev_info(dev, "property: %s\n", key);
|
||||||
print_hex_dump(KERN_INFO, pr_fmt(), DUMP_PREFIX_OFFSET,
|
print_hex_dump(KERN_INFO, pr_fmt(), DUMP_PREFIX_OFFSET,
|
||||||
16, 1, entry[i].pointer.u8_data,
|
16, 1, entry_data, entry_len, true);
|
||||||
entry[i].length, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr += key_len + val_len;
|
ptr += key_len + val_len;
|
||||||
|
Loading…
Reference in New Issue
Block a user