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

misc: at25: Don't copy garbage to the at25->chip in FRAM case

Even if we know that we are going to fill everything later on
it's bad style and fragile to copy garbage from the stack to
the data structure that will be used in the driver.

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-3-andriy.shevchenko@linux.intel.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 5b557298
......@@ -390,7 +390,10 @@ static int at25_probe(struct spi_device *spi)
/* Chip description */
if (!spi->dev.platform_data) {
if (!is_fram) {
if (is_fram) {
/* We file fields for FRAM case later on */
memset(&chip, 0, sizeof(chip));
} else {
err = at25_fw_to_chip(&spi->dev, &chip);
if (err)
return err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册