cmd: usbdown: fix return value for cmd funtions
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Fri, 21 Oct 2016 02:28:42 +0000 (11:28 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Tue, 20 Oct 2020 01:35:21 +0000 (10:35 +0900)
The return value for cmd functions should not be errno, so this
patch fixes to use proper return value for cmd functions.

Change-Id: I9584ed2e12b81d7807e4fc0b41dbf714462acd1c
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
cmd/usbdown.c

index 1cd544f..9f7c6c4 100644 (file)
@@ -324,12 +324,12 @@ int do_update(cmd_tbl_t *cmdtp, int flags, int argc, char * const argv[])
                mmc = find_mmc_device(0);
                if (!mmc) {
                        printf("Device MMC %d - not found!", 0);
-                       return -ENODEV;
+                       return CMD_RET_FAILURE;
                }
 
                if (mmc_init(mmc)) {
                        printf("Couldn't init MMC device.\n");
-                       return -ENODEV;
+                       return CMD_RET_FAILURE;
                }
 
                /* Used the mmc 0 by default */
@@ -341,38 +341,38 @@ int do_update(cmd_tbl_t *cmdtp, int flags, int argc, char * const argv[])
                        stor_dev = blk_get_devnum_by_type(IF_TYPE_USB, dev);
                        if (stor_dev == NULL) {
                                printf("unknown device\n");
-                               return -ENODEV;
+                               return CMD_RET_FAILURE;
                        }
 
                        printf("\n    Device %d: ", dev);
                        dev_print(stor_dev);
                        if (stor_dev->type == DEV_TYPE_UNKNOWN)
-                               return 1;
+                               return CMD_RET_FAILURE;
                        usb_stor_curr_dev = dev;
                        printf("... is now current device\n");
                }
 
                if (fs_set_blk_dev(from, argv[1], FS_TYPE_ANY)) {
                        printf("%d: Unknown block device..\n", __LINE__);
-                       return -ENODEV;
+                       return CMD_RET_FAILURE;
                }
 
                alt_num = usbdown_get_alt(filename);
                if (alt_num < 0) {
                        printf("There is no %s information\n", filename);
-                       return -EINVAL;
+                       return CMD_RET_FAILURE;
                }
 
                ret = fs_size(filename, &size);
                if (ret < 0) {
                        printf("There is no %s\n", filename);
-                       return -EINVAL;
+                       return CMD_RET_FAILURE;
                }
 
                usbdown = usbdown_get_entity(alt_num);
                if (!usbdown) {
                        printf("there is no information for %d\n", alt_num);
-                       return -EINVAL;
+                       return CMD_RET_FAILURE;
                }
 
 #ifdef CONFIG_SIG
@@ -431,7 +431,7 @@ int do_update(cmd_tbl_t *cmdtp, int flags, int argc, char * const argv[])
                                                usbdown->dev_num,
                                                usbdown->hw_partition);
                                if (ret)
-                                       return ret;
+                                       return CMD_RET_FAILURE;
                        }
 
                        while (size > 0) {
@@ -457,7 +457,7 @@ int do_update(cmd_tbl_t *cmdtp, int flags, int argc, char * const argv[])
                                                blk_select_hwpart_devnum(IF_TYPE_MMC,
                                                                usbdown->dev_num,
                                                                part_num_bkp);
-                                       return -EIO;
+                                       return CMD_RET_FAILURE;
                                }
 
 #ifndef CONFIG_BLK
@@ -480,10 +480,10 @@ int do_update(cmd_tbl_t *cmdtp, int flags, int argc, char * const argv[])
                        ret = blk_select_hwpart_devnum(IF_TYPE_MMC, usbdown->dev_num,
                                        part_num_bkp);
                        if (ret)
-                               return ret;
+                               return CMD_RET_FAILURE;
                }
 
-               return 0;
+               return CMD_RET_SUCCESS;
        }
 
        return CMD_RET_USAGE;
@@ -553,7 +553,7 @@ static int do_usb_down(cmd_tbl_t *cmdtp, int flags, int argc, char * const argv[
                        printf("\n");
                }
 
-               return 0;
+               return CMD_RET_SUCCESS;
        }
 
        return CMD_RET_USAGE;