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>
diff --git a/drivers/usb/gadget/legacy/printer.c b/drivers/usb/gadget/legacy/printer.c
index 12247d3..eb02a6b 100644
--- a/drivers/usb/gadget/legacy/printer.c
+++ b/drivers/usb/gadget/legacy/printer.c
@@ -1285,6 +1285,7 @@
fail:
printer_cfg_unbind(c);
+ usb_remove_function(c, &dev->function);
return status;
}