diff options
author | Hans de Goede <hdegoede@redhat.com> | 2012-05-22 05:36:59 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-13 19:07:22 -0400 |
commit | e714fad054e219b52eee17591d95d725888a95c4 (patch) | |
tree | fc7c750d9f27aa61ecdaadcef3a1c57a9ba6118f /drivers/usb/core | |
parent | 4d4847b8502ec093864936a4669318675c0ced22 (diff) |
usb-core: Set intfdata to NULL if a driver's probe method failed
Ensure that intfdata always is NULL if no driver is bound:
1) drvdata is for a driver to store a pointer to driver specific data
2) If no driver is bound, there is no driver specific data associated with
the device
3) Thus logically drvdata should be NULL if no driver is bound.
We already set intfdata to NULL when a driver is unbound, to ensure that
intfdata will be NULL even if the drivers disconnect method does not properly
clear it. This ensures that intfdata will also be NULL after a failed probe,
even if the driver's probe method left a (likely dangling) pointer in there.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/driver.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 23d7bbd199a5..69781016a266 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -367,6 +367,7 @@ static int usb_probe_interface(struct device *dev) | |||
367 | return error; | 367 | return error; |
368 | 368 | ||
369 | err: | 369 | err: |
370 | usb_set_intfdata(intf, NULL); | ||
370 | intf->needs_remote_wakeup = 0; | 371 | intf->needs_remote_wakeup = 0; |
371 | intf->condition = USB_INTERFACE_UNBOUND; | 372 | intf->condition = USB_INTERFACE_UNBOUND; |
372 | usb_cancel_queued_reset(intf); | 373 | usb_cancel_queued_reset(intf); |