]> git.baikalelectronics.ru Git - kernel.git/commit
usb: gadget: fix a bug and a WARN_ON in dummy-hcd
authorAlan Stern <stern@rowland.harvard.edu>
Tue, 30 Jul 2013 19:18:15 +0000 (15:18 -0400)
committerFelipe Balbi <balbi@ti.com>
Tue, 17 Sep 2013 15:38:51 +0000 (10:38 -0500)
commit394997fe00242872e23e08f7c7d5a579c71accd2
tree8c1f09ec3d2928798a096fb8df9bb5cd3cd1683c
parentd7e3824b3af755382ca21c9ccf9a391c3844593d
usb: gadget: fix a bug and a WARN_ON in dummy-hcd

This patch fixes a NULL pointer dereference and a WARN_ON in
dummy-hcd.  These things were the result of moving to the UDC core
framework, and possibly of changes to that framework.

Now unloading a gadget driver causes the UDC to be stopped after the
gadget driver is unbound, not before.  Therefore the "driver" argument
to dummy_udc_stop() can be NULL, so we must not try to print the
driver's name without checking first.

Also, the UDC framework automatically unregisters the gadget when the
UDC is deleted.  Therefore a sysfs attribute file attached to the
gadget must be removed before the UDC is deleted, not after.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: <stable@vger.kernel.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/dummy_hcd.c