Commit 7d4e3289 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

[PATCH] USB: Fix EHCI boot oops on AMD

> > ----- Forwarded message from Andi Kleen <ak@suse.de> -----
> > Someone added an test for AMD 8111 in EHCI, returning
> > an error in reset.
> >
> > When triggered it would cause an NULL pointer oops because
> > it would usb_hcd_put an half initialized hcd without
> > initialized class.  I added a new usb_hcd_free function
> > to handle such half baked objects.

Andi's diagnosis is correct -- the embedded class_device was not fully
initialized -- but the solution is wrong.  The correct patch
is below.  This was clearly my fault, an error in driver-model
programming brought on by lack of documentation about which fields in the
driver-model structures need to be set for which API calls.  (Greg, long
ago I sent you a documentation patch to try and help remedy this problem,
but it seems to have fallen by the wayside.)
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent c633526d
...@@ -676,6 +676,7 @@ void usb_bus_init (struct usb_bus *bus) ...@@ -676,6 +676,7 @@ void usb_bus_init (struct usb_bus *bus)
INIT_LIST_HEAD (&bus->bus_list); INIT_LIST_HEAD (&bus->bus_list);
class_device_initialize(&bus->class_dev); class_device_initialize(&bus->class_dev);
bus->class_dev.class = &usb_host_class;
} }
EXPORT_SYMBOL (usb_bus_init); EXPORT_SYMBOL (usb_bus_init);
...@@ -732,7 +733,6 @@ int usb_register_bus(struct usb_bus *bus) ...@@ -732,7 +733,6 @@ int usb_register_bus(struct usb_bus *bus)
} }
snprintf(bus->class_dev.class_id, BUS_ID_SIZE, "usb%d", busnum); snprintf(bus->class_dev.class_id, BUS_ID_SIZE, "usb%d", busnum);
bus->class_dev.class = &usb_host_class;
bus->class_dev.dev = bus->controller; bus->class_dev.dev = bus->controller;
retval = class_device_add(&bus->class_dev); retval = class_device_add(&bus->class_dev);
if (retval) { if (retval) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment