From 3fd417a1c9bf2f53cfcc493a034fe64c58d56c1a Mon Sep 17 00:00:00 2001 From: Radoslaw Koppel Date: Thu, 23 May 2019 15:53:24 +0200 Subject: [PATCH] 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 --- subsys/storage/flash_map/flash_map.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/storage/flash_map/flash_map.c b/subsys/storage/flash_map/flash_map.c index 46b896957f7..4c20e875398 100644 --- a/subsys/storage/flash_map/flash_map.c +++ b/subsys/storage/flash_map/flash_map.c @@ -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);