aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libmtd.c2
-rw-r--r--ubi-utils/mtdinfo.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/libmtd.c b/lib/libmtd.c
index aff4c8b..a6665f0 100644
--- a/lib/libmtd.c
+++ b/lib/libmtd.c
@@ -901,6 +901,8 @@ int mtd_regioninfo(int fd, int regidx, struct region_info_user *reginfo)
return -1;
}
+ reginfo->regionindex = regidx;
+
ret = ioctl(fd, MEMGETREGIONINFO, reginfo);
if (ret < 0)
return sys_errmsg("%s ioctl failed for erase region %d",
diff --git a/ubi-utils/mtdinfo.c b/ubi-utils/mtdinfo.c
index 5ac95aa..a86abd1 100644
--- a/ubi-utils/mtdinfo.c
+++ b/ubi-utils/mtdinfo.c
@@ -253,6 +253,8 @@ static void print_region_info(const struct mtd_dev_info *mtd)
if (!args.node || (!args.map && mtd->region_cnt == 0))
return;
+ memset(&reginfo, 0, sizeof(reginfo));
+
/* First open the device so we can query it */
fd = open(args.node, O_RDONLY | O_CLOEXEC);
if (fd == -1) {