From 10c2044062d045e27cbcda739501b96f670fb7f1 Mon Sep 17 00:00:00 2001 From: Tien Fong Chee Date: Fri, 6 Jul 2018 16:25:12 +0800 Subject: 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 Reviewed-by: Marek Vasut Reviewed-by: Heiko Schocher [trini: Fix conflicting type error in cmd/ubi.c] Signed-off-by: Tom Rini --- cmd/ubifs.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'cmd/ubifs.c') diff --git a/cmd/ubifs.c b/cmd/ubifs.c index 11bab7a1a1..171034801b 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, -- cgit v1.2.1