subsys/storage/flash_map: Fix returned error codes

Fix that removes magic numbers from the code that
leaded to the error codes that was hard to explain.

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
This commit is contained in:
Radoslaw Koppel 2019-05-23 15:53:24 +02:00 committed by Carles Cufí
commit 3fd417a1c9

View file

@ -180,7 +180,7 @@ int flash_area_read(const struct flash_area *fa, off_t off, void *dst,
struct device *dev;
if (!is_in_flash_area_bounds(fa, off, len)) {
return -1;
return -EINVAL;
}
dev = device_get_binding(fa->fa_dev_name);
@ -195,7 +195,7 @@ int flash_area_write(const struct flash_area *fa, off_t off, const void *src,
int rc;
if (!is_in_flash_area_bounds(fa, off, len)) {
return -1;
return -EINVAL;
}
flash_dev = device_get_binding(fa->fa_dev_name);
@ -219,7 +219,7 @@ int flash_area_erase(const struct flash_area *fa, off_t off, size_t len)
int rc;
if (!is_in_flash_area_bounds(fa, off, len)) {
return -1;
return -EINVAL;
}
flash_dev = device_get_binding(fa->fa_dev_name);