Skip to contentSkip to conversation

usb: ums: add error handling for failed registration

PATCH New Stephen Warren 3 participants 3 messages May 1, 2014 – May 6, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: ums: add error handling for failed registration

From: Stephen Warren <[email protected]>

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.

---
 common/cmd_usb_mass_storage.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
common/cmd_usb_mass_storage.c +5 -1
index d8d9efd4f62b..31b7eb0b57ef 100644
@@ -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;
Signature · 1 line
1.8.1.5
#2 lore raw

PATCH 1/1 usb: ums: add error handling for failed registration

Hi Marek,

Quoted 7 lines · Stephen Warren
Quoted 6 lines

From: Stephen Warren <[email protected]>

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.

Quoted 8 lines
Quoted 1 line

Lukasz, can you pick this please?

Best regards,
Marek Vasut

Applied to u-boot-dfu. Thanks.

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group