aboutsummaryrefslogtreecommitdiffstats
path: root/common/cmd_ubi.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2010-12-16 23:00:53 +0100
committerWolfgang Denk <wd@denx.de>2010-12-16 23:00:53 +0100
commit006915fbb0e3c1c9927fe32c4e92cb011f8499e7 (patch)
treeb477df920f7d638a0472aa1d6bfa5ff71243448c /common/cmd_ubi.c
parent98e69567022eb2138dd99554b3a2e80522a1b153 (diff)
parentb5d58d8500bfb918c7fec56f241e6ee1078c2be0 (diff)
downloadu-boot-midas-006915fbb0e3c1c9927fe32c4e92cb011f8499e7.tar.gz
u-boot-midas-006915fbb0e3c1c9927fe32c4e92cb011f8499e7.tar.bz2
u-boot-midas-006915fbb0e3c1c9927fe32c4e92cb011f8499e7.zip
Merge branch 'master' of ../master into next
Diffstat (limited to 'common/cmd_ubi.c')
-rw-r--r--common/cmd_ubi.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c
index 7692ac7716..b486ca8fef 100644
--- a/common/cmd_ubi.c
+++ b/common/cmd_ubi.c
@@ -42,6 +42,11 @@ struct selected_dev {
static struct selected_dev ubi_dev;
+#ifdef CONFIG_CMD_UBIFS
+int ubifs_is_mounted(void);
+void cmd_ubifs_umount(void);
+#endif
+
static void ubi_dump_vol_info(const struct ubi_volume *vol)
{
ubi_msg("volume information dump:");
@@ -472,6 +477,16 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
if (argc < 3)
return cmd_usage(cmdtp);
+#ifdef CONFIG_CMD_UBIFS
+ /*
+ * Automatically unmount UBIFS partition when user
+ * changes the UBI device. Otherwise the following
+ * UBIFS commands will crash.
+ */
+ if (ubifs_is_mounted())
+ cmd_ubifs_umount();
+#endif
+
/* todo: get dev number for NAND... */
ubi_dev.nr = 0;