storage/flash_map: Return -ENODEV from flash_area_open
The commit adds check, to flash_area_open, whether there is any device driver attached and returns -ENODEV if there isn't any. This works around a problem where flash_area_open succeeds but consecutive read/write causes crash. It is enough to check the condition, and return error, here as the flash_area_open has to precede, and be checked for success, any read/write operations. Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This commit is contained in:
parent
8b7ec919c8
commit
aa5d20aaef
2 changed files with 7 additions and 1 deletions
|
@ -37,7 +37,12 @@ int flash_area_open(uint8_t id, const struct flash_area **fap)
|
|||
return -ENOENT;
|
||||
}
|
||||
|
||||
if (device_get_binding(area->fa_dev_name) == NULL) {
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
*fap = area;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue