rockchip: boot_rkimg: fix wrong size for bootloader_message

size in byte for malloc, and in block/512bytes for blk read.

Change-Id: I0534a13838ff00452d9ca472d7caea03502cc058
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
This commit is contained in:
Kever Yang 2017-12-14 10:52:54 +08:00
parent b7c7eca21d
commit 1a3726ad91
1 changed files with 3 additions and 2 deletions

View File

@ -158,7 +158,8 @@ int rockchip_get_boot_mode(void)
struct blk_desc *dev_desc;
disk_partition_t part_info;
struct bootloader_message *bmsg;
int size = DIV_ROUND_UP(sizeof(struct bootloader_message), RK_BLK_SIZE);
int size = DIV_ROUND_UP(sizeof(struct bootloader_message), RK_BLK_SIZE)
* RK_BLK_SIZE;
int ret;
if (boot_mode != -1)
@ -173,7 +174,7 @@ int rockchip_get_boot_mode(void)
bmsg = memalign(ARCH_DMA_MINALIGN, size);
ret = blk_dread(dev_desc,
part_info.start + BOOTLOADER_MESSAGE_BLK_OFFSET,
size, bmsg);
size >> 9, bmsg);
if (ret < 0)
goto err;