diff options
author | Stephen Warren <swarren@nvidia.com> | 2014-05-01 15:42:10 -0600 |
---|---|---|
committer | Lukasz Majewski <l.majewski@samsung.com> | 2014-05-08 10:38:29 +0200 |
commit | 66b88b07cdab041ac0cf6a9bf5b131aedc248089 (patch) | |
tree | 374be3ccb4240ef80f93edff6a86f44e0c8cdb4f /common/cmd_usb_mass_storage.c | |
parent | 340ed422d2a58c4858ba8e110c233e8ae92c04e0 (diff) | |
download | u-boot-66b88b07cdab041ac0cf6a9bf5b131aedc248089.tar.gz |
usb: ums: add error handling for failed registration
Without this, if g_dnl_register() fails, the UMS code continues on
blindly and crashes. This fix makes it simply print an error message
instead.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'common/cmd_usb_mass_storage.c')
-rw-r--r-- | common/cmd_usb_mass_storage.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c index d8d9efd4f6..31b7eb0b57 100644 --- a/common/cmd_usb_mass_storage.c +++ b/common/cmd_usb_mass_storage.c @@ -40,7 +40,11 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag, return CMD_RET_FAILURE; } - g_dnl_register("usb_dnl_ums"); + rc = g_dnl_register("usb_dnl_ums"); + if (rc) { + error("g_dnl_register failed"); + return CMD_RET_FAILURE; + } /* Timeout unit: seconds */ int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT; |