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

Signed-off-by: Andrzej Pietrasiewicz <andrze...@samsung.com>
---
 drivers/usb/gadget/legacy/printer.c | 1 +
 1 file changed, 1 insertion(+)

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 @@ static int __init printer_bind_config(struct 
usb_configuration *c)
 
 fail:
        printer_cfg_unbind(c);
+       usb_remove_function(c, &dev->function);
        return status;
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to