aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm2708/patches-3.10/0050-dwc_otg-Fix-incorrect-URB-allocation-error-handling.patch
blob: 828d9804c2369216a563fd1f443cb9c71ff1ebd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From e3e9b6dbd5507ea5e571acae3ef6ed2e2d5dadcf Mon Sep 17 00:00:00 2001
From: P33M <P33M@github.com>
Date: Fri, 15 Feb 2013 22:38:40 +0000
Subject: [PATCH 050/174] dwc_otg: Fix incorrect URB allocation error handling

If the memory allocation for a dwc_otg_urb failed, the kernel would OOPS
because for some reason a member of the *unallocated* struct was set to
zero. Error handling changed to fail correctly.
---
 drivers/usb/host/dwc_otg/dwc_otg_hcd.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c
@@ -3136,17 +3136,13 @@ dwc_otg_hcd_urb_t *dwc_otg_hcd_urb_alloc
 	else
 		dwc_otg_urb = DWC_ALLOC(size);
 
-        if (NULL != dwc_otg_urb)
-                dwc_otg_urb->packet_count = iso_desc_count;
+        if (dwc_otg_urb)
+		dwc_otg_urb->packet_count = iso_desc_count;
         else {
-                dwc_otg_urb->packet_count = 0;
-                if (size != 0) {
-                        DWC_ERROR("**** DWC OTG HCD URB alloc - "
-                                  "%salloc of %db failed\n",
-                                  atomic_alloc?"atomic ":"", size);
-                }
-        }
-
+		DWC_ERROR("**** DWC OTG HCD URB alloc - "
+			"%salloc of %db failed\n",
+			atomic_alloc?"atomic ":"", size);
+	}
 	return dwc_otg_urb;
 }