Skip to content

Commit 0e3e975

Browse files
author
Felipe Balbi
committed
usb: gadget: composite: make sure to reactivate function on unbind
If a function sets bind_deactivated flag, upon removal we will be left with an unbalanced deactivation. Let's make sure that we conditionally call usb_function_activate() from usb_remove_function() and make sure usb_remove_function() is called from remove_config(). Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
1 parent afbbc79 commit 0e3e975

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/usb/gadget/composite.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,9 @@ void usb_remove_function(struct usb_configuration *c, struct usb_function *f)
315315
list_del(&f->list);
316316
if (f->unbind)
317317
f->unbind(c, f);
318+
319+
if (f->bind_deactivated)
320+
usb_function_activate(f);
318321
}
319322
EXPORT_SYMBOL_GPL(usb_remove_function);
320323

@@ -956,12 +959,8 @@ static void remove_config(struct usb_composite_dev *cdev,
956959

957960
f = list_first_entry(&config->functions,
958961
struct usb_function, list);
959-
list_del(&f->list);
960-
if (f->unbind) {
961-
DBG(cdev, "unbind function '%s'/%p\n", f->name, f);
962-
f->unbind(config, f);
963-
/* may free memory for "f" */
964-
}
962+
963+
usb_remove_function(config, f);
965964
}
966965
list_del(&config->list);
967966
if (config->unbind) {

0 commit comments

Comments
 (0)