From: Michal Simek <michal.simek@xilinx.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] spl: spi: Do not hardcode fixed size for header
Date: Thu, 4 Oct 2018 09:30:20 +0200 [thread overview]
Message-ID: <1b783b83d7a8be59ffaa7c11dbdf5e805a2192b5.1538638218.git.michal.simek@xilinx.com> (raw)
Find out size directly from header structure.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
common/spl/spl_spi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c
index e10cf0124fb7..5180c001a9b8 100644
--- a/common/spl/spl_spi.c
+++ b/common/spl/spl_spi.c
@@ -28,7 +28,7 @@ static int spi_load_image_os(struct spl_image_info *spl_image,
int err;
/* Read for a header, parse or error out. */
- spi_flash_read(flash, CONFIG_SYS_SPI_KERNEL_OFFS, 0x40,
+ spi_flash_read(flash, CONFIG_SYS_SPI_KERNEL_OFFS, sizeof(*header),
(void *)header);
if (image_get_magic(header) != IH_MAGIC)
@@ -88,7 +88,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
return -ENODEV;
}
- header = spl_get_load_buffer(-sizeof(*header), 0x40);
+ header = spl_get_load_buffer(-sizeof(*header), sizeof(*header));
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
payload_offs = fdtdec_get_config_int(gd->fdt_blob,
@@ -101,7 +101,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
#endif
{
/* Load u-boot, mkimage header is 64 bytes. */
- err = spi_flash_read(flash, payload_offs, 0x40,
+ err = spi_flash_read(flash, payload_offs, sizeof(*header),
(void *)header);
if (err) {
debug("%s: Failed to read from SPI flash (err=%d)\n",
--
1.9.1
next reply other threads:[~2018-10-04 7:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-04 7:30 Michal Simek [this message]
2018-10-07 0:29 ` [U-Boot] spl: spi: Do not hardcode fixed size for header 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=1b783b83d7a8be59ffaa7c11dbdf5e805a2192b5.1538638218.git.michal.simek@xilinx.com \
--to=michal.simek@xilinx.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.