usb: musb: core: properly free host / device structs in err path
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Wed, 16 Oct 2013 10:50:06 +0000 (12:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Nov 2013 19:28:12 +0000 (11:28 -0800)
commit78bf8811f05d10a9ecdbe5f1825a3b9e6b8d8fed
tree1a046f17c7433f6b278cf36142dde897649df6fa
parent35908a35cc40c44ff009611cd9054b02f37f882b
usb: musb: core: properly free host / device structs in err path

commit 0d2dd7eaed1dac07b266ca2c662ff4a184a3060f upstream.

The patch fixes two issues in the error path cleanup:
- in MUSB_PORT_MODE_DUAL_ROLE mode, if musb_gadget_setup() fails we
  never cleanup the host struct earlier allocated.
- if musb_init_debugfs() or sysfs_create_group() fails, then we never
  free the host part initialization, only device part.

Cc: Daniel Mack <zonque@gmail.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/musb/musb_core.c