From: Stephen Warren Date: Thu, 1 May 2014 21:42:10 +0000 (-0600) Subject: usb: ums: add error handling for failed registration X-Git-Tag: v2014.07-rc2~11^2~13 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=66b88b07cdab041ac0cf6a9bf5b131aedc248089;p=oweals%2Fu-boot.git 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 --- 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;