From: Andrzej Pietrasiewicz Date: Tue, 3 Mar 2015 09:52:08 +0000 (+0100) Subject: usb: gadget: printer: revert usb_add_function() effect in error recovery X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=f5bda0034fba942adf5555246e248ddb66c76052;p=linux-beck.git 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 Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/gadget/legacy/printer.c b/drivers/usb/gadget/legacy/printer.c index 12247d3fe768..eb02a6b8da08 100644 --- a/drivers/usb/gadget/legacy/printer.c +++ b/drivers/usb/gadget/legacy/printer.c @@ -1285,6 +1285,7 @@ static int __init printer_bind_config(struct usb_configuration *c) fail: printer_cfg_unbind(c); + usb_remove_function(c, &dev->function); return status; }