Skip to content

Commit 102dff8

Browse files
de-nordicrghaddab
authored andcommitted
[nrf fromtree] drivers: flash: shell: Add support for devices without erase
Shell will now work with devices that do not implement erase callback. Signed-off-by: Dominik Ermel <[email protected]> (cherry picked from commit 7e65860)
1 parent 985e038 commit 102dff8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/flash/flash_shell.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ static int cmd_erase(const struct shell *sh, size_t argc, char *argv[])
7575
{
7676
const struct device *flash_dev;
7777
uint32_t page_addr;
78-
int result;
78+
int result = -ENOTSUP;
7979
uint32_t size;
8080

81+
#if defined(CONFIG_FLASH_HAS_EXPLICIT_ERASE)
8182
result = parse_helper(sh, &argc, &argv, &flash_dev, &page_addr);
8283
if (result) {
8384
return result;
@@ -106,6 +107,7 @@ static int cmd_erase(const struct shell *sh, size_t argc, char *argv[])
106107
} else {
107108
shell_print(sh, "Erase success.");
108109
}
110+
#endif
109111

110112
return result;
111113
}

0 commit comments

Comments
 (0)