Patch from openwrt commit r20062 regarding erase_len.

Correct types inside two fprintf functions.

Signed-off-by: Luka Perkov < lists ->-to->- lukaperkov.net >
---

diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index ed6b53f..4e4f6aa 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -488,7 +488,7 @@ int fw_setenv(int argc, char *argv[])
                        value = (char *)malloc(len - strlen(name));
                        if (!value) {
                                fprintf(stderr,
-                               "Cannot malloc %u bytes: %s\n",
+                               "Cannot malloc %zu bytes: %s\n",
                                len - strlen(name), strerror(errno));
                                return -1;
                        }
@@ -779,7 +779,10 @@ static int flash_write_buf (int dev, int fd, void *buf, 
size_t count,
        erase_offset = (offset / blocklen) * blocklen;
 
        /* Maximum area we may use */
-       erase_len = top_of_range - erase_offset;
+       if (mtd_type == MTD_NANDFLASH)
+               erase_len = top_of_range - erase_offset;
+       else
+               erase_len = blocklen;
 
        blockstart = erase_offset;
        /* Offset inside a block */
@@ -802,7 +805,7 @@ static int flash_write_buf (int dev, int fd, void *buf, 
size_t count,
                data = malloc (erase_len);
                if (!data) {
                        fprintf (stderr,
-                                "Cannot malloc %u bytes: %s\n",
+                                "Cannot malloc %zu bytes: %s\n",
                                 erase_len, strerror (errno));
                        return -1;
                }
_______________________________________________
U-Boot mailing list
[email protected]
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to