diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2013-10-16 12:50:06 +0200 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-10-17 11:30:33 -0500 |
commit | 0d2dd7eaed1dac07b266ca2c662ff4a184a3060f (patch) | |
tree | fb1c33727d8e993a6acdff2b798fb1c81e929492 /drivers/usb | |
parent | 5bb7289d7f9d5c7418892c342824196602d20729 (diff) |
usb: musb: core: properly free host / device structs in err path
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: stable@vger.kernel.org # v3.11
Cc: Daniel Mack <zonque@gmail.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/musb/musb_core.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 5b4fa79a277..6203ad38e91 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1901,6 +1901,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) if (status < 0) goto fail3; status = musb_gadget_setup(musb); + if (status) + musb_host_cleanup(musb); break; default: dev_err(dev, "unsupported port mode %d\n", musb->port_mode); @@ -1927,6 +1929,7 @@ fail5: fail4: musb_gadget_cleanup(musb); + musb_host_cleanup(musb); fail3: if (musb->dma_controller) |