Skip to contentSkip to conversation

usb: host: check kzalloc() result

PATCH Applied Kulikov Vasiliy 1 participant 1 message Jul 16, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 9/15 usb: host: check kzalloc() result

If kzalloc() fails exit with -ENOMEM.

---
 drivers/usb/host/sl811-hcd.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/usb/host/sl811-hcd.c +4 -1
index bcf9f0e..990f06b 100644
@@ -813,8 +813,11 @@ static int sl811h_urb_enqueue(
 #endif
 
 	/* avoid all allocations within spinlocks */
-	if (!hep->hcpriv)
+	if (!hep->hcpriv) {
 		ep = kzalloc(sizeof *ep, mem_flags);
+		if (ep = NULL)
+			return -ENOMEM;
+	}
 
 	spin_lock_irqsave(&sl811->lock, flags);
 
Signature · 1 line
1.7.0.4