summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory CLEMENT <gregory.clement@free-electrons.com>2014-03-03 17:48:34 +0100
committerBen Hutchings <ben@decadent.org.uk>2014-04-30 16:23:20 +0100
commit631f96b5e27fdf9dc7b7e78201c01d05321f1494 (patch)
tree1c69f7ae66932de173df8a1bdb0a5ae8facd2bde
parent165f9a52923ddaf70ada17d3d957d832b89f15c4 (diff)
downloadlwn-631f96b5e27fdf9dc7b7e78201c01d05321f1494.tar.gz
lwn-631f96b5e27fdf9dc7b7e78201c01d05321f1494.zip
usb: gadget: atmel_usba: fix crashed during stopping when DEBUG is enabled
commit d8eb6c653ef6b323d630de3c5685478469e248bc upstream. commit 511f3c5 (usb: gadget: udc-core: fix a regression during gadget driver unbinding) introduced a crash when DEBUG is enabled. The debug trace in the atmel_usba_stop function made the assumption that the driver pointer passed in parameter was not NULL, but since the commit above, such assumption was no longer always true. This commit now uses the driver pointer stored in udc which fixes this issue. [ balbi@ti.com : improved commit log a bit ] Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Felipe Balbi <balbi@ti.com> [bwh: Backported to 3.2: adjust context] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index 271a9d873608..b299c328f51a 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1875,12 +1875,13 @@ static int atmel_usba_stop(struct usb_gadget_driver *driver)
driver->unbind(&udc->gadget);
udc->gadget.dev.driver = NULL;
- udc->driver = NULL;
clk_disable(udc->hclk);
clk_disable(udc->pclk);
- DBG(DBG_GADGET, "unregistered driver `%s'\n", driver->driver.name);
+ DBG(DBG_GADGET, "unregistered driver `%s'\n", udc->driver->driver.name);
+
+ udc->driver = NULL;
return 0;
}