diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2021-11-25 23:27:28 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-12-03 14:25:22 +0100 |
commit | a692fc39bf90913f3cea57ee240ea5d6338da235 (patch) | |
tree | f34937fb371edde5e76e74ec2e070f3309b578e6 /drivers/misc/eeprom | |
parent | 5b557298d7d09cce04e0565a535fbca63661724a (diff) | |
download | linux-rpi-a692fc39bf90913f3cea57ee240ea5d6338da235.tar.gz linux-rpi-a692fc39bf90913f3cea57ee240ea5d6338da235.tar.bz2 linux-rpi-a692fc39bf90913f3cea57ee240ea5d6338da235.zip |
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: 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-3-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 | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c index 57599eac2f71..f0b0efc30ee6 100644 --- a/drivers/misc/eeprom/at25.c +++ b/drivers/misc/eeprom/at25.c @@ -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; |