diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2021-11-25 22:27:29 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-12-03 14:25:22 +0100 |
commit | 58589a75bba96f43b62d8069b35be081bc00d7c3 (patch) | |
tree | b0214abc4e36c260555faeb8c01f0f84a6533658 /drivers/misc/eeprom | |
parent | misc: at25: Don't copy garbage to the at25->chip in FRAM case (diff) | |
download | linux-58589a75bba96f43b62d8069b35be081bc00d7c3.tar.xz linux-58589a75bba96f43b62d8069b35be081bc00d7c3.zip |
misc: at25: Check proper value of chip length in FRAM case
Obviously the byte_len value should be checked from the chip
and not from at25->chip.
Fixes: fd307a4ad332 ("nvmem: prepare basics for FRAM support")
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20211125212729.86585-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/eeprom')
-rw-r--r-- | drivers/misc/eeprom/at25.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c index f0b0efc30ee6..e21216541b0f 100644 --- a/drivers/misc/eeprom/at25.c +++ b/drivers/misc/eeprom/at25.c @@ -433,9 +433,9 @@ static int at25_probe(struct spi_device *spi) dev_err(&spi->dev, "Error: unsupported size (id %02x)\n", id[7]); return -ENODEV; } - chip.byte_len = int_pow(2, id[7] - 0x21 + 4) * 1024; - if (at25->chip.byte_len > 64 * 1024) + chip.byte_len = int_pow(2, id[7] - 0x21 + 4) * 1024; + if (chip.byte_len > 64 * 1024) at25->chip.flags |= EE_ADDR3; else at25->chip.flags |= EE_ADDR2; |