Browse Source

usb: gadget: printer: revert usb_add_function() effect in error recovery

Whenever the "goto fail" branch is taken, the effect of usb_add_function()
should be reverted.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Andrzej Pietrasiewicz 10 years ago
parent
commit
f5bda0034f
1 changed files with 1 additions and 0 deletions
  1. 1 0
      drivers/usb/gadget/legacy/printer.c

+ 1 - 0
drivers/usb/gadget/legacy/printer.c

@@ -1285,6 +1285,7 @@ static int __init printer_bind_config(struct usb_configuration *c)
 
 
 fail:
 fail:
 	printer_cfg_unbind(c);
 	printer_cfg_unbind(c);
+	usb_remove_function(c, &dev->function);
 	return status;
 	return status;
 }
 }