Skip to content

Commit

Permalink
drivers: flash: shell: Add support for devices without erase
Browse files Browse the repository at this point in the history
Shell will now work with devices that do not implement erase callback.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
  • Loading branch information
de-nordic committed Apr 1, 2024
1 parent 1caed99 commit 9b88dd2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/flash/flash_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ static int cmd_erase(const struct shell *sh, size_t argc, char *argv[])
{
const struct device *flash_dev;
uint32_t page_addr;
int result;
int result = -ENOTSUP;
uint32_t size;

#if defined(CONFIG_FLASH_HAS_EXPLICIT_ERASE)
result = parse_helper(sh, &argc, &argv, &flash_dev, &page_addr);
if (result) {
return result;
Expand Down Expand Up @@ -106,6 +107,7 @@ static int cmd_erase(const struct shell *sh, size_t argc, char *argv[])
} else {
shell_print(sh, "Erase success.");
}
#endif

return result;
}
Expand Down

0 comments on commit 9b88dd2

Please sign in to comment.