]> git.sur5r.net Git - u-boot/blobdiff - common/cmd_nand.c
sandbox: config: enable fdt and snprintf() options
[u-boot] / common / cmd_nand.c
index 3e2edb8aaabd4cf1c8ff32f0f6575a039944e3ca..035a6f64af2fa9aad4e784ef893dbcee067d47bb 100644 (file)
@@ -48,7 +48,7 @@ static int nand_dump(nand_info_t *nand, ulong off, int only_oob, int repeat)
 
        last = off;
 
-       datbuf = malloc(nand->writesize + nand->oobsize);
+       datbuf = malloc(nand->writesize);
        oobbuf = malloc(nand->oobsize);
        if (!datbuf || !oobbuf) {
                puts("No memory for page buffer\n");
@@ -59,7 +59,7 @@ static int nand_dump(nand_info_t *nand, ulong off, int only_oob, int repeat)
        struct mtd_oob_ops ops;
        memset(&ops, 0, sizeof(ops));
        ops.datbuf = datbuf;
-       ops.oobbuf = oobbuf; /* must exist, but oob data will be appended to ops.datbuf */
+       ops.oobbuf = oobbuf;
        ops.len = nand->writesize;
        ops.ooblen = nand->oobsize;
        ops.mode = MTD_OOB_RAW;
@@ -85,6 +85,7 @@ static int nand_dump(nand_info_t *nand, ulong off, int only_oob, int repeat)
        }
        puts("OOB:\n");
        i = nand->oobsize >> 3;
+       p = oobbuf;
        while (i--) {
                printf("\t%02x %02x %02x %02x %02x %02x %02x %02x\n",
                       p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
@@ -357,7 +358,7 @@ int do_nand_env_oob(cmd_tbl_t *cmdtp, int argc, char *const argv[])
        return ret;
 
 usage:
-       return cmd_usage(cmdtp);
+       return CMD_RET_USAGE;
 }
 
 #endif
@@ -719,7 +720,7 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 #endif
 
 usage:
-       return cmd_usage(cmdtp);
+       return CMD_RET_USAGE;
 }
 
 U_BOOT_CMD(
@@ -908,7 +909,7 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 usage:
 #endif
                show_boot_progress(-53);
-               return cmd_usage(cmdtp);
+               return CMD_RET_USAGE;
        }
 
        show_boot_progress(53);