提交 fb422f44 编写于 作者: A Andy Shevchenko 提交者: Greg Kroah-Hartman

misc: at25: Check new property ("address-width") first

As it's done elsewhere in at25_fw_to_chip() check new property
("address-width") first.
Acked-by: NArnd Bergmann <arnd@arndb.de>
Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20211125213203.86693-4-andriy.shevchenko@linux.intel.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 c329fe53
...@@ -327,13 +327,15 @@ static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip) ...@@ -327,13 +327,15 @@ static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip)
} }
chip->page_size = val; 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) { if (err) {
err = device_property_read_u32(dev, "address-width", &val); err = device_property_read_u32(dev, "at25,addr-mode", &val);
if (err) { if (err) {
dev_err(dev, "Error: missing \"address-width\" property\n"); dev_err(dev, "Error: missing \"address-width\" property\n");
return err; return err;
} }
chip->flags = (u16)val;
} else {
switch (val) { switch (val) {
case 9: case 9:
chip->flags |= EE_INSTR_BIT3_IS_ADDR; chip->flags |= EE_INSTR_BIT3_IS_ADDR;
...@@ -355,8 +357,6 @@ static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip) ...@@ -355,8 +357,6 @@ static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip)
} }
if (device_property_present(dev, "read-only")) if (device_property_present(dev, "read-only"))
chip->flags |= EE_READONLY; chip->flags |= EE_READONLY;
} else {
chip->flags = (u16)val;
} }
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册