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, 11 Apr 2017 09:58:17 +0000 (18:58 +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 c0085cadc14f0680c54263a3fd2aca6fc5810678..81350ed5ffe578facd166d59e0d217ee8a4c6b65 100644 (file)
@@ -320,12 +320,12 @@ int do_update(cmd_tbl_t *cmdtp, int flags, int argc, char * const argv[])
                mmc = find_mmc_device(0);
                if (!mmc) {
                        error("Device MMC %d - not found!", 0);
-                       return -ENODEV;
+                       return CMD_RET_FAILURE;
                }
 
                if (mmc_init(mmc)) {
                        error("Couldn't init MMC device.\n");
-                       return -ENODEV;
+                       return CMD_RET_FAILURE;
                }
 
                /* Used the mmc 0 by default */
@@ -337,38 +337,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
@@ -423,7 +423,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) {
@@ -449,7 +449,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;
                                }
 
                                mmc->block_dev.block_write(&mmc->block_dev,
@@ -466,10 +466,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;
@@ -539,7 +539,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;