cmd_mtdparts.c: report ECC status along with the partition map karo-tx48 KARO-TX48-2016-05-06
authorLothar Waßmann <LW@KARO-electronics.de>
Fri, 6 May 2016 14:22:39 +0000 (16:22 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 6 May 2016 14:22:39 +0000 (16:22 +0200)
common/cmd_mtdparts.c

index 8cc5c38..a2289df 100644 (file)
@@ -1229,6 +1229,18 @@ static uint64_t net_part_size(struct mtd_info *mtd, struct part_info *part)
 }
 #endif
 
+static void show_ecc_stats(struct mtd_device *dev)
+{
+       struct mtd_info *mtd;
+
+       if (get_mtd_info(dev->id->type, dev->id->num, &mtd))
+               return;
+
+       printf("ECC stats for device %s:\n", mtd->name);
+       printf("  corrected bit flips:\t%4u\n", mtd->ecc_stats.corrected);
+       printf("  uncorrectable errors:\t%4u\n", mtd->ecc_stats.failed);
+}
+
 static void print_partition_table(void)
 {
        struct list_head *dentry, *pentry;
@@ -1276,6 +1288,7 @@ static void print_partition_table(void)
 #endif /* defined(CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES) */
                        part_num++;
                }
+               show_ecc_stats(dev);
        }
 
        if (list_empty(&devices))