]> git.sur5r.net Git - u-boot/commitdiff
usb: ums: add error handling for failed registration
authorStephen Warren <swarren@nvidia.com>
Thu, 1 May 2014 21:42:10 +0000 (15:42 -0600)
committerLukasz Majewski <l.majewski@samsung.com>
Thu, 8 May 2014 08:38:29 +0000 (10:38 +0200)
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>
common/cmd_usb_mass_storage.c

index d8d9efd4f62b348b6ad553fbb95c1d50d3b824a4..31b7eb0b57ef5dd7ac9217bc441d25804dcaac75 100644 (file)
@@ -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;