[3.13.y.z extended stable] Patch "usb: gadget: atmel_usba: fix crashed during stopping when DEBUG is enabled" has been added to staging queue

Kamal Mostafa kamal at canonical.com
Thu May 1 19:17:09 UTC 2014

This is a note to let you know that I have just added a patch titled

    usb: gadget: atmel_usba: fix crashed during stopping when DEBUG is enabled

to the linux-3.13.y-queue branch of the 3.13.y.z extended stable tree 
which can be found at:


This patch is scheduled to be released in version

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.13.y.z tree, see



>From d660e9c06ff5cf989bd37c42389f68fbdc343a92 Mon Sep 17 00:00:00 2001
From: Gregory CLEMENT <gregory.clement at free-electrons.com>
Date: Mon, 3 Mar 2014 17:48:34 +0100
Subject: usb: gadget: atmel_usba: fix crashed during stopping when DEBUG is

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

[ balbi at ti.com : improved commit log a bit ]

Acked-by: Alexandre Belloni <alexandre.belloni at free-electrons.com>
Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>
Signed-off-by: Felipe Balbi <balbi at ti.com>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
 drivers/usb/gadget/atmel_usba_udc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index 2cb52e0..1e53092 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1827,12 +1827,12 @@ static int atmel_usba_stop(struct usb_gadget *gadget,
 	usba_writel(udc, CTRL, USBA_DISABLE_MASK);

-	udc->driver = NULL;

-	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;

More information about the kernel-team mailing list