Skip to content

Commit 6e98503

Browse files
andy-shevingomolnar
authored andcommitted
efi/apple-properties: Remove redundant attribute initialization from unmarshal_key_value_pairs()
There is no need to artificially supply a property length and fake data if property has type of boolean. Remove redundant piece of data and code. Reviewed-and-tested-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Matt Fleming <matt@codeblueprint.co.uk> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/20180308080020.22828-3-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 6b31a2f commit 6e98503

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

‎drivers/firmware/efi/apple-properties.c‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ struct properties_header {
5252
struct dev_header dev_header[0];
5353
};
5454

55-
static u8 one __initdata = 1;
56-
5755
static void __init unmarshal_key_value_pairs(struct dev_header *dev_header,
5856
struct device *dev, void *ptr,
5957
struct property_entry entry[])
@@ -95,14 +93,9 @@ static void __init unmarshal_key_value_pairs(struct dev_header *dev_header,
9593
key_len - sizeof(key_len));
9694

9795
entry[i].name = key;
98-
entry[i].is_array = true;
9996
entry[i].length = val_len - sizeof(val_len);
97+
entry[i].is_array = !!entry[i].length;
10098
entry[i].pointer.raw_data = ptr + key_len + sizeof(val_len);
101-
if (!entry[i].length) {
102-
/* driver core doesn't accept empty properties */
103-
entry[i].length = 1;
104-
entry[i].pointer.raw_data = &one;
105-
}
10699

107100
if (dump_properties) {
108101
dev_info(dev, "property: %s\n", entry[i].name);

0 commit comments

Comments
 (0)