mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
ANDROID: usb: gadget: Do not disconnect unregistered dev
configfs_composite_unbind sets the gadget data to null. Therefore, add check in disconnect function to make sure that cdev is not NULL. Prints a WARN message if the driver tries to redundantly disconnect a gadget. Signed-off-by: Badhri Jagan Sridharan <badhri@google.com> Change-Id: I248cb7175d0dd9a51c18053dd39475d8b3284f6d
This commit is contained in:
committed by
Dmitry Shmidt
parent
3cad9bef9d
commit
9061f251d4
@@ -1983,6 +1983,12 @@ void composite_disconnect(struct usb_gadget *gadget)
|
||||
struct usb_composite_dev *cdev = get_gadget_data(gadget);
|
||||
unsigned long flags;
|
||||
|
||||
if (cdev == NULL) {
|
||||
WARN(1, "%s: Calling disconnect on a Gadget that is \
|
||||
not connected\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
/* REVISIT: should we have config and device level
|
||||
* disconnect callbacks?
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user