aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorTien Fong Chee2018-07-06 16:25:12 +0800
committerTom Rini2018-09-28 20:21:47 -0400
commit10c2044062d045e27cbcda739501b96f670fb7f1 (patch)
treead70e9979e585a401a640a9743032717954d756b /cmd
parentbbef20d479441b01d62252cf127498c58078b2c3 (diff)
cmd: ubifs: Move ubifs_initialized checking into cmd_ubifs_umount()
cmd_ubifs_umount() function would be called directly instead of involving whole command machinery in generic firmware loader, so checking on ubifs_initialized status need to be done in cmd_ubifs_umount() without breaking original functionality design. Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com> Reviewed-by: Marek Vasut <marex@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de> [trini: Fix conflicting type error in cmd/ubi.c] Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ubi.c3
-rw-r--r--cmd/ubifs.c18
2 files changed, 10 insertions, 11 deletions
diff --git a/cmd/ubi.c b/cmd/ubi.c
index 913f0f71fd9..0fa7553072a 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -47,8 +47,7 @@ struct selected_dev {
static struct selected_dev ubi_dev;
#ifdef CONFIG_CMD_UBIFS
-int ubifs_is_mounted(void);
-void cmd_ubifs_umount(void);
+#include <ubifs_uboot.h>
#endif
static void display_volume_info(struct ubi_device *ubi)
diff --git a/cmd/ubifs.c b/cmd/ubifs.c
index 11bab7a1a1f..171034801b7 100644
--- a/cmd/ubifs.c
+++ b/cmd/ubifs.c
@@ -50,11 +50,18 @@ int ubifs_is_mounted(void)
return ubifs_mounted;
}
-void cmd_ubifs_umount(void)
+int cmd_ubifs_umount(void)
{
+ if (ubifs_initialized == 0) {
+ printf("No UBIFS volume mounted!\n");
+ return -1;
+ }
+
uboot_ubifs_umount();
ubifs_mounted = 0;
ubifs_initialized = 0;
+
+ return 0;
}
static int do_ubifs_umount(cmd_tbl_t *cmdtp, int flag, int argc,
@@ -63,14 +70,7 @@ static int do_ubifs_umount(cmd_tbl_t *cmdtp, int flag, int argc,
if (argc != 1)
return CMD_RET_USAGE;
- if (ubifs_initialized == 0) {
- printf("No UBIFS volume mounted!\n");
- return -1;
- }
-
- cmd_ubifs_umount();
-
- return 0;
+ return cmd_ubifs_umount();
}
static int do_ubifs_ls(cmd_tbl_t *cmdtp, int flag, int argc,