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

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: fd307a4a ("nvmem: prepare basics for FRAM support")
Acked-by: NArnd Bergmann <arnd@arndb.de>
Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20211125212729.86585-4-andriy.shevchenko@linux.intel.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 a692fc39
...@@ -433,9 +433,9 @@ static int at25_probe(struct spi_device *spi) ...@@ -433,9 +433,9 @@ static int at25_probe(struct spi_device *spi)
dev_err(&spi->dev, "Error: unsupported size (id %02x)\n", id[7]); dev_err(&spi->dev, "Error: unsupported size (id %02x)\n", id[7]);
return -ENODEV; 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; at25->chip.flags |= EE_ADDR3;
else else
at25->chip.flags |= EE_ADDR2; at25->chip.flags |= EE_ADDR2;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册