]> git.sur5r.net Git - u-boot/blobdiff - common/cmd_mtdparts.c
sandbox: config: enable fdt and snprintf() options
[u-boot] / common / cmd_mtdparts.c
index 17865b756b4c3ec1244904bb2c50d0b750f4ca2b..22688293ae18c822f035398482d4005c85ca259f 100644 (file)
@@ -838,7 +838,8 @@ static int device_parse(const char *const mtd_dev, const char **ret, struct mtd_
        struct mtdids *id;
        const char *mtd_id;
        unsigned int mtd_id_len;
-       const char *p, *pend;
+       const char *p;
+       const char *pend;
        LIST_HEAD(tmp_list);
        struct list_head *entry, *n;
        u16 num_parts;
@@ -868,10 +869,12 @@ static int device_parse(const char *const mtd_dev, const char **ret, struct mtd_
                return 1;
        }
 
+#ifdef DEBUG
+       pend = strchr(p, ';');
+#endif
        debug("dev type = %d (%s), dev num = %d, mtd-id = %s\n",
                        id->type, MTD_DEV_TYPE(id->type),
                        id->num, id->mtd_id);
-       pend = strchr(p, ';');
        debug("parsing partitions %.*s\n", (pend ? pend - p : strlen(p)), p);
 
 
@@ -1228,15 +1231,16 @@ static int generate_mtdparts_save(char *buf, u32 buflen)
  */
 static uint64_t net_part_size(struct mtd_info *mtd, struct part_info *part)
 {
+       uint64_t i, net_size = 0;
+
        if (!mtd->block_isbad)
                return part->size;
 
-       uint64_t i, net_size = 0;
-
        for (i = 0; i < part->size; i += mtd->erasesize) {
                if (!mtd->block_isbad(mtd, part->offset + i))
                        net_size += mtd->erasesize;
        }
+
        return net_size;
 }
 #endif
@@ -2031,7 +2035,7 @@ int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                return spread_partitions();
 #endif /* CONFIG_CMD_MTDPARTS_SPREAD */
 
-       return cmd_usage(cmdtp);
+       return CMD_RET_USAGE;
 }
 
 /***************************************************/