When a failure occurs when selecting the device or partition, the user should be
notified through an error print.

Signed-off-by: Paul Kocialkowski <cont...@paulk.fr>
---
 common/cmd_part.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/common/cmd_part.c b/common/cmd_part.c
index b33498b..39c870b 100644
--- a/common/cmd_part.c
+++ b/common/cmd_part.c
@@ -38,8 +38,10 @@ static int do_part_uuid(int argc, char * const argv[])
                return CMD_RET_USAGE;
 
        part = get_device_and_partition(argv[0], argv[1], &dev_desc, &info, 0);
-       if (part < 0)
+       if (part < 0) {
+               error("Invalid device and/or partition\n");
                return 1;
+       }
 
        if (argc > 2)
                setenv(argv[2], info.uuid);
@@ -82,8 +84,10 @@ static int do_part_list(int argc, char * const argv[])
        }
 
        ret = get_device(argv[0], argv[1], &desc);
-       if (ret < 0)
+       if (ret < 0) {
+               error("Invalid device\n");
                return 1;
+       }
 
        if (var != NULL) {
                int p;
@@ -127,12 +131,16 @@ static int do_part_start(int argc, char * const argv[])
        part = simple_strtoul(argv[2], NULL, 0);
 
        ret = get_device(argv[0], argv[1], &desc);
-       if (ret < 0)
+       if (ret < 0) {
+               error("Invalid device\n");
                return 1;
+       }
 
        err = get_partition_info(desc, part, &info);
-       if (err)
+       if (err) {
+               error("Invalid partition number\n");
                return 1;
+       }
 
        snprintf(&buf, sizeof(buf), "0x%x", info.start);
        setenv(argv[3], buf);
@@ -155,12 +163,16 @@ static int do_part_size(int argc, char * const argv[])
        part = simple_strtoul(argv[2], NULL, 0);
 
        ret = get_device(argv[0], argv[1], &desc);
-       if (ret < 0)
+       if (ret < 0) {
+               error("Invalid device\n");
                return 1;
+       }
 
        err = get_partition_info(desc, part, &info);
-       if (err)
+       if (err) {
+               error("Invalid partition number\n");
                return 1;
+       }
 
        snprintf(&buf, sizeof(buf), "0x%x", info.size);
        setenv(argv[3], buf);
-- 
1.9.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to