subsys/storage/flash_map: detect missing flash device
If the flash device is not configured, return an error rather than dereferencing a null device pointer. Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
parent
7f2edeef6c
commit
e3ba01ec76
2 changed files with 6 additions and 1 deletions
|
@ -139,6 +139,9 @@ flash_page_cb cb, struct layout_data *cb_data)
|
|||
cb_data->status = 0;
|
||||
|
||||
flash_dev = device_get_binding(fa->fa_dev_name);
|
||||
if (flash_dev == NULL) {
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
flash_page_foreach(flash_dev, cb, cb_data);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue