Skip to content

Commit

Permalink
fs: shell: Allow retries after a mount failure
Browse files Browse the repository at this point in the history
Clean up if the mount command fails, such as due to a typo in the mount
point name, so that it can be retried.

Signed-off-by: Phil Hindman <phindman@xes-inc.com>
  • Loading branch information
pahindman committed Oct 17, 2024
1 parent 2bfc2a3 commit 5465b23
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions subsys/fs/shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,8 @@ static int cmd_mount_fat(const struct shell *sh, size_t argc, char **argv)
if (res != 0) {
shell_error(sh,
"Error mounting FAT fs. Error Code [%d]", res);
k_free((void *)fatfs_mnt.mnt_point);
fatfs_mnt.mnt_point = NULL;
return -ENOEXEC;
}

Expand Down Expand Up @@ -808,6 +810,8 @@ static int cmd_mount_littlefs(const struct shell *sh, size_t argc, char **argv)

if (rc != 0) {
shell_error(sh, "Error mounting as littlefs: %d", rc);
k_free((void *)littlefs_mnt.mnt_point);
littlefs_mnt.mnt_point = NULL;
return -ENOEXEC;
}

Expand Down

0 comments on commit 5465b23

Please sign in to comment.