]> git.sur5r.net Git - u-boot/commitdiff
dm: blk: Use the correct error code for blk_get_device_by_str()
authorSimon Glass <sjg@chromium.org>
Sun, 1 May 2016 19:52:36 +0000 (13:52 -0600)
committerSimon Glass <sjg@chromium.org>
Tue, 17 May 2016 15:54:43 +0000 (09:54 -0600)
Return -EINVAL instead of -1 in this function, to provide a more meaningful
error.

Signed-off-by: Simon Glass <sjg@chromium.org>
disk/part.c

index 3039f5f2352856e338a4c52382ab8fc2f783cf21..6a1c02d9fada7410c953cd144c2ea6968fb3a200 100644 (file)
@@ -350,7 +350,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;
        }
 
@@ -359,7 +359,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;
                }
        }
@@ -367,7 +367,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;
        }