Skip to content

Commit

Permalink
efi/apple-properties: Remove redundant attribute initialization from …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Andy Shevchenko authored and Ingo Molnar committed Mar 9, 2018
1 parent 6b31a2f commit 6e98503
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions drivers/firmware/efi/apple-properties.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ struct properties_header {
struct dev_header dev_header[0];
};

static u8 one __initdata = 1;

static void __init unmarshal_key_value_pairs(struct dev_header *dev_header,
struct device *dev, void *ptr,
struct property_entry entry[])
Expand Down Expand Up @@ -95,14 +93,9 @@ static void __init unmarshal_key_value_pairs(struct dev_header *dev_header,
key_len - sizeof(key_len));

entry[i].name = key;
entry[i].is_array = true;
entry[i].length = val_len - sizeof(val_len);
entry[i].is_array = !!entry[i].length;
entry[i].pointer.raw_data = ptr + key_len + sizeof(val_len);
if (!entry[i].length) {
/* driver core doesn't accept empty properties */
entry[i].length = 1;
entry[i].pointer.raw_data = &one;
}

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

0 comments on commit 6e98503

Please sign in to comment.