[U-Boot] [PATCH 15/23] dm: blk: Use the correct error code for blk_get_device_by_str()

Simon Glass sjg at chromium.org
Mon Apr 11 03:12:35 CEST 2016


Return -EINVAL instead of -1 in this function, to provide a more meaningful
error.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 disk/part.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/disk/part.c b/disk/part.c
index 4b850fa..f5950d0 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -349,7 +349,7 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str,
 	if (*ep) {
 		printf("** Bad device specification %s %s **\n",
 		       ifname, dev_str);
-		dev = -1;
+		dev = -EINVAL;
 		goto cleanup;
 	}
 
@@ -358,7 +358,7 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str,
 		if (*ep) {
 			printf("** Bad HW partition specification %s %s **\n",
 			    ifname, hwpart_str);
-			dev = -1;
+			dev = -EINVAL;
 			goto cleanup;
 		}
 	}
@@ -366,7 +366,7 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str,
 	*dev_desc = get_dev_hwpart(ifname, dev, hwpart);
 	if (!(*dev_desc) || ((*dev_desc)->type == DEV_TYPE_UNKNOWN)) {
 		printf("** Bad device %s %s **\n", ifname, dev_hwpart_str);
-		dev = -1;
+		dev = -ENOENT;
 		goto cleanup;
 	}
 
-- 
2.8.0.rc3.226.g39d4020



More information about the U-Boot mailing list