diff options
Diffstat (limited to 'drivers/usb/core/hcd.c')
-rw-r--r-- | drivers/usb/core/hcd.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 40c7a46ba7d3..3ba27118adc5 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -2191,6 +2191,15 @@ struct usb_hcd *usb_create_hcd (const struct hc_driver *driver, | |||
2191 | dev_dbg (dev, "hcd alloc failed\n"); | 2191 | dev_dbg (dev, "hcd alloc failed\n"); |
2192 | return NULL; | 2192 | return NULL; |
2193 | } | 2193 | } |
2194 | hcd->bandwidth_mutex = kmalloc(sizeof(*hcd->bandwidth_mutex), | ||
2195 | GFP_KERNEL); | ||
2196 | if (!hcd->bandwidth_mutex) { | ||
2197 | kfree(hcd); | ||
2198 | dev_dbg(dev, "hcd bandwidth mutex alloc failed\n"); | ||
2199 | return NULL; | ||
2200 | } | ||
2201 | mutex_init(hcd->bandwidth_mutex); | ||
2202 | |||
2194 | dev_set_drvdata(dev, hcd); | 2203 | dev_set_drvdata(dev, hcd); |
2195 | kref_init(&hcd->kref); | 2204 | kref_init(&hcd->kref); |
2196 | 2205 | ||
@@ -2205,7 +2214,6 @@ struct usb_hcd *usb_create_hcd (const struct hc_driver *driver, | |||
2205 | #ifdef CONFIG_USB_SUSPEND | 2214 | #ifdef CONFIG_USB_SUSPEND |
2206 | INIT_WORK(&hcd->wakeup_work, hcd_resume_work); | 2215 | INIT_WORK(&hcd->wakeup_work, hcd_resume_work); |
2207 | #endif | 2216 | #endif |
2208 | mutex_init(&hcd->bandwidth_mutex); | ||
2209 | 2217 | ||
2210 | hcd->driver = driver; | 2218 | hcd->driver = driver; |
2211 | hcd->product_desc = (driver->product_desc) ? driver->product_desc : | 2219 | hcd->product_desc = (driver->product_desc) ? driver->product_desc : |
@@ -2218,6 +2226,7 @@ static void hcd_release (struct kref *kref) | |||
2218 | { | 2226 | { |
2219 | struct usb_hcd *hcd = container_of (kref, struct usb_hcd, kref); | 2227 | struct usb_hcd *hcd = container_of (kref, struct usb_hcd, kref); |
2220 | 2228 | ||
2229 | kfree(hcd->bandwidth_mutex); | ||
2221 | kfree(hcd); | 2230 | kfree(hcd); |
2222 | } | 2231 | } |
2223 | 2232 | ||