diff options
author | Stephen Warren <swarren@nvidia.com> | 2014-05-05 10:40:17 -0600 |
---|---|---|
committer | Lukasz Majewski <l.majewski@samsung.com> | 2014-05-08 10:38:29 +0200 |
commit | 1725f12882eca6424d70dcdc962ca4e5c2de798a (patch) | |
tree | 228bec353994de59d21e986fdfc414d3313ab1ab | |
parent | d0cc456dc3561d473926e60fb10ab643790a9ac7 (diff) | |
download | u-boot-imx-1725f12882eca6424d70dcdc962ca4e5c2de798a.zip u-boot-imx-1725f12882eca6424d70dcdc962ca4e5c2de798a.tar.gz u-boot-imx-1725f12882eca6424d70dcdc962ca4e5c2de798a.tar.bz2 |
ums: move all variable declarations to the start of the block
It's easier to assign values to the variables inside an if statement body
if the assignment and declaration are separate.
Cc: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
-rw-r--r-- | common/cmd_usb_mass_storage.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c index b5954fc..5e02116 100644 --- a/common/cmd_usb_mass_storage.c +++ b/common/cmd_usb_mass_storage.c @@ -65,25 +65,33 @@ struct ums *ums_init(const char *devtype, const char *devnum) int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { + const char *usb_controller; + const char *devtype; + const char *devnum; + struct ums *ums; + unsigned int controller_index; + int rc; + int cable_ready_timeout __maybe_unused; + if (argc < 3) return CMD_RET_USAGE; - const char *usb_controller = argv[1]; - const char *devtype = "mmc"; - const char *devnum = argv[2]; + usb_controller = argv[1]; + devtype = "mmc"; + devnum = argv[2]; - struct ums *ums = ums_init(devtype, devnum); + ums = ums_init(devtype, devnum); if (!ums) return CMD_RET_FAILURE; - unsigned int controller_index = (unsigned int)(simple_strtoul( - usb_controller, NULL, 0)); + controller_index = (unsigned int)(simple_strtoul( + usb_controller, NULL, 0)); if (board_usb_init(controller_index, USB_INIT_DEVICE)) { error("Couldn't init USB controller."); return CMD_RET_FAILURE; } - int rc = fsg_init(ums); + rc = fsg_init(ums); if (rc) { error("fsg_init failed"); return CMD_RET_FAILURE; @@ -96,7 +104,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag, } /* Timeout unit: seconds */ - int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT; + cable_ready_timeout = UMS_CABLE_READY_TIMEOUT; if (!g_dnl_board_usb_cable_connected()) { /* |