diff options
author | Michal Simek <michal.simek@xilinx.com> | 2018-10-04 09:30:20 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-10-06 14:09:42 -0400 |
commit | 51c12319b44a9fdb12192cb2d97efe32fce8ca49 (patch) | |
tree | 67435a8fb781549454ea66e4918efd5cb1fb193a /common/spl/spl_spi.c | |
parent | 83a64560dd4f352832fbfc508a9c8904809f55d1 (diff) | |
download | u-boot-51c12319b44a9fdb12192cb2d97efe32fce8ca49.tar.gz u-boot-51c12319b44a9fdb12192cb2d97efe32fce8ca49.tar.bz2 u-boot-51c12319b44a9fdb12192cb2d97efe32fce8ca49.zip |
spl: spi: Do not hardcode fixed size for header
Find out size directly from header structure.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'common/spl/spl_spi.c')
-rw-r--r-- | common/spl/spl_spi.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c index ddc33fd3ce..8cd4830a39 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", |