From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-kernel@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Prchal <jiri.prchal@aksignal.cz>
Subject: [PATCH v1 2/3] misc: at25: Don't copy garbage to the at25->chip in FRAM case
Date: Thu, 25 Nov 2021 23:27:28 +0200 [thread overview]
Message-ID: <20211125212729.86585-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20211125212729.86585-1-andriy.shevchenko@linux.intel.com>
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")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/misc/eeprom/at25.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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;
--
2.33.0
next prev parent reply other threads:[~2021-11-25 21:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-25 21:27 [PATCH v1 0/3] misc: at25: Fix issues brought with FRAM support Andy Shevchenko
2021-11-25 21:27 ` [PATCH v1 1/3] misc: at25: Make driver OF independent again Andy Shevchenko
2021-11-25 21:27 ` Andy Shevchenko [this message]
2021-11-25 21:27 ` [PATCH v1 3/3] misc: at25: Check proper value of chip length in FRAM case Andy Shevchenko
2021-11-25 21:47 ` [PATCH v1 0/3] misc: at25: Fix issues brought with FRAM support Arnd Bergmann
2021-11-25 22:01 ` Andy Shevchenko
2021-12-01 14:19 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211125212729.86585-3-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=jiri.prchal@aksignal.cz \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome