Skip to content

Commit

Permalink
misc: at25: Check new property ("address-width") first
Browse files Browse the repository at this point in the history
As it's done elsewhere in at25_fw_to_chip() check new property
("address-width") first.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20211125213203.86693-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Andy Shevchenko authored and Greg Kroah-Hartman committed Dec 3, 2021
1 parent c329fe5 commit fb422f4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/misc/eeprom/at25.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,15 @@ static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip)
}
chip->page_size = val;

err = device_property_read_u32(dev, "at25,addr-mode", &val);
err = device_property_read_u32(dev, "address-width", &val);
if (err) {
err = device_property_read_u32(dev, "address-width", &val);
err = device_property_read_u32(dev, "at25,addr-mode", &val);
if (err) {
dev_err(dev, "Error: missing \"address-width\" property\n");
return err;
}
chip->flags = (u16)val;
} else {
switch (val) {
case 9:
chip->flags |= EE_INSTR_BIT3_IS_ADDR;
Expand All @@ -355,8 +357,6 @@ static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip)
}
if (device_property_present(dev, "read-only"))
chip->flags |= EE_READONLY;
} else {
chip->flags = (u16)val;
}
return 0;
}
Expand Down

0 comments on commit fb422f4

Please sign in to comment.