Commit 0d2dd7ea authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Felipe Balbi

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: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 5bb7289d
...@@ -1901,6 +1901,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) ...@@ -1901,6 +1901,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
if (status < 0) if (status < 0)
goto fail3; goto fail3;
status = musb_gadget_setup(musb); status = musb_gadget_setup(musb);
if (status)
musb_host_cleanup(musb);
break; break;
default: default:
dev_err(dev, "unsupported port mode %d\n", musb->port_mode); dev_err(dev, "unsupported port mode %d\n", musb->port_mode);
...@@ -1927,6 +1929,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) ...@@ -1927,6 +1929,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
fail4: fail4:
musb_gadget_cleanup(musb); musb_gadget_cleanup(musb);
musb_host_cleanup(musb);
fail3: fail3:
if (musb->dma_controller) if (musb->dma_controller)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment