All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] spl: spi: Do not hardcode fixed size for header
@ 2018-10-04  7:30 Michal Simek
  2018-10-07  0:29 ` [U-Boot] " Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Simek @ 2018-10-04  7:30 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] spl: spi: Do not hardcode fixed size for header
  2018-10-04  7:30 [U-Boot] [PATCH] spl: spi: Do not hardcode fixed size for header Michal Simek
@ 2018-10-07  0:29 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2018-10-07  0:29 UTC (permalink / raw)
  To: u-boot

On Thu, Oct 04, 2018 at 09:30:20AM +0200, Michal Simek wrote:

> Find out size directly from header structure.
> 
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181006/5441db7a/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-07  0:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-04  7:30 [U-Boot] [PATCH] spl: spi: Do not hardcode fixed size for header Michal Simek
2018-10-07  0:29 ` [U-Boot] " Tom Rini

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.