Skip to content

Commit

Permalink
usb: gadget: atmel_usba: fix crashed during stopping when DEBUG is en…
Browse files Browse the repository at this point in the history
…abled

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 ]

Cc: <stable@vger.kernel.org> # v3.2+
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>
  • Loading branch information
Gregory CLEMENT authored and Felipe Balbi committed Mar 5, 2014
1 parent fb0e139 commit d8eb6c6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/usb/gadget/atmel_usba_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1827,12 +1827,12 @@ static int atmel_usba_stop(struct usb_gadget *gadget,
toggle_bias(0);
usba_writel(udc, CTRL, USBA_DISABLE_MASK);

udc->driver = NULL;

clk_disable_unprepare(udc->hclk);
clk_disable_unprepare(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;
}
Expand Down

0 comments on commit d8eb6c6

Please sign in to comment.