From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] env: sf: fix environment in SPI NOR
Date: Fri, 18 Jan 2019 10:45:56 +0100 [thread overview]
Message-ID: <20190118094556.1542119-1-hs@denx.de> (raw)
commit 9a9d66f5eff0 ("env: add spi_flash_read_env function")
breaks Environment functionality, as it reads only
until 2 \0 are found, but fills the buffer with 0x0
instead 0xff which leads in an incorrect crc sum.
Fix: init the read buffer with 0xff instead 0x00
Signed-off-by: Heiko Schocher <hs@denx.de>
---
env/sf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/env/sf.c b/env/sf.c
index b3dec82c35..31dd003575 100644
--- a/env/sf.c
+++ b/env/sf.c
@@ -98,7 +98,7 @@ static int spi_flash_read_env(struct spi_flash *flash, u32 offset, size_t len,
u32 addr = 0;
u32 page_size = flash->page_size;
- memset(buf, 0x0, len);
+ memset(buf, 0xff, len);
for (int i = 0; i < len / page_size; ++i) {
int ret = spi_flash_read(flash, offset, page_size,
&((char *)buf)[addr]);
--
2.17.2
next reply other threads:[~2019-01-18 9:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-18 9:45 Heiko Schocher [this message]
2019-01-19 2:54 ` [U-Boot] env: sf: fix environment in SPI NOR Tom Rini
2019-01-21 9:53 ` Heiko Schocher
2019-01-21 15:46 ` Tom Rini
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=20190118094556.1542119-1-hs@denx.de \
--to=hs@denx.de \
--cc=u-boot@lists.denx.de \
/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