usb: gadget: printer: add missing error handling
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Tue, 3 Mar 2015 09:52:09 +0000 (10:52 +0100)
committerFelipe Balbi <balbi@ti.com>
Tue, 10 Mar 2015 20:33:35 +0000 (15:33 -0500)
commit07e6675c40c32e0c138e9a4c1f1987c2880aa196
treed7cebd8bc5131a390a584ef025ed23372091a9cb
parent972dda0dfdc92b2ec73cd55f6c57c6fc1f738f08
usb: gadget: printer: add missing error handling

If cdev_add() in printer_bind_config() fails, care is taken to
reverse the effects of initializations completed until the fail
happens. But if printer_req_alloc() fails, it is just one of the
two lists that is cleaned up while the effects of cdev_add()
and device_create() are not reverted.

This patch changes error handling so that at least as much cleanup is done
as when a failure happens before printer_req_alloc() invocations.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/legacy/printer.c