"Das U-Boot" Source Tree
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cmd: zip: Add missing unmap_sysmem() for buffers in the unzip command

Unmap the sysmem that got mapped by this command.

Use symbolic return value for the command while updating
the return value handling.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

authored by

Marek Vasut and committed by
Tom Rini
109e378e 3a76ba66

+13 -4
+13 -4
cmd/unzip.c
··· 16 16 { 17 17 unsigned long src, dst; 18 18 unsigned long src_len = ~0UL, dst_len = ~0UL; 19 + void *srcp, *dstp; 20 + int ret; 19 21 20 22 switch (argc) { 21 23 case 4: ··· 29 31 return CMD_RET_USAGE; 30 32 } 31 33 32 - if (gunzip(map_sysmem(dst, dst_len), dst_len, map_sysmem(src, 0), 33 - &src_len) != 0) 34 - return 1; 34 + srcp = map_sysmem(dst, dst_len); 35 + dstp = map_sysmem(src, 0); 36 + 37 + ret = gunzip(srcp, dst_len, dstp, &src_len); 38 + 39 + unmap_sysmem(dstp); 40 + unmap_sysmem(srcp); 41 + 42 + if (ret) 43 + return CMD_RET_FAILURE; 35 44 36 45 printf("Uncompressed size: %lu = 0x%lX\n", src_len, src_len); 37 46 env_set_hex("filesize", src_len); 38 47 39 - return 0; 48 + return CMD_RET_SUCCESS; 40 49 } 41 50 42 51 U_BOOT_CMD(