From f388818b1790aed07c5f4b620286ec65b0a5cbf0 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Fri, 21 Oct 2016 11:28:42 +0900 Subject: [PATCH] cmd: usbdown: fix return value for cmd funtions 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 --- cmd/usbdown.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/cmd/usbdown.c b/cmd/usbdown.c index f1b2e67..1937a18 100644 --- a/cmd/usbdown.c +++ b/cmd/usbdown.c @@ -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 = usb_stor_get_dev(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 @@ -422,7 +422,7 @@ int do_update(cmd_tbl_t *cmdtp, int flags, int argc, char * const argv[]) ret = mmc_select_hwpart(usbdown->dev_num, usbdown->hw_partition); if (ret) - return ret; + return CMD_RET_FAILURE; } while (size > 0) { @@ -446,7 +446,7 @@ int do_update(cmd_tbl_t *cmdtp, int flags, int argc, char * const argv[]) if (usbdown->hw_partition >= 0) mmc_select_hwpart(usbdown->dev_num, part_num_bkp); - return -EIO; + return CMD_RET_FAILURE; } mmc->block_dev.block_write(&mmc->block_dev, @@ -462,10 +462,10 @@ int do_update(cmd_tbl_t *cmdtp, int flags, int argc, char * const argv[]) if (usbdown->hw_partition >= 0) { ret = mmc_select_hwpart(usbdown->dev_num, part_num_bkp); if (ret) - return ret; + return CMD_RET_FAILURE; } - return 0; + return CMD_RET_SUCCESS; } return CMD_RET_USAGE; @@ -535,7 +535,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; -- 2.7.4