diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2013-11-06 03:25:27 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-11-25 11:54:21 -0500 |
commit | 66fadea5b79c07154126bb0db375be915f611246 (patch) | |
tree | 50a604e3039782ba3afd5c50609ff2f7bebdaebc /drivers/usb | |
parent | 2bac51a1827a18821150ed8c9f9752c02f9c2b02 (diff) |
usb: musb: only cancel work if it is initialized
Since commit c5340bd14 ("usb: musb: cancel work on removal") the workqueue
is cancelled but then if we bail out before the workqueue is setup we
get this:
|INFO: trying to register non-static key.
|the code is fine but needs lockdep annotation.
|turning off the locking correctness validator.
|CPU: 0 PID: 708 Comm: modprobe Not tainted 3.12.0+ #435
|[<c00867bc>] (lock_acquire+0xf0/0x108) from [<c00529d0>] (flush_work+0x38/0x2ec)
|[<c00529d0>] (flush_work+0x38/0x2ec) from [<c0052d24>] (__cancel_work_timer+0xa0/0x134)
|[<c0052d24>] (__cancel_work_timer+0xa0/0x134) from [<bf0e4ae4>] (musb_free+0x40/0x60 [musb_hdrc])
|[<bf0e4ae4>] (musb_free+0x40/0x60 [musb_hdrc]) from [<bf0e5364>] (musb_probe+0x678/0xb78 [musb_hdrc])
|[<bf0e5364>] (musb_probe+0x678/0xb78 [musb_hdrc]) from [<c0294bf0>] (platform_drv_probe+0x1c/0x24)
|[<c0294bf0>] (platform_drv_probe+0x1c/0x24) from [<c0293970>] (driver_probe_device+0x90/0x224)
|[<c0293970>] (driver_probe_device+0x90/0x224) from [<c0291ef0>] (bus_for_each_drv+0x60/0x8c)
|[<c0291ef0>] (bus_for_each_drv+0x60/0x8c) from [<c02938bc>] (device_attach+0x80/0xa4)
|[<c02938bc>] (device_attach+0x80/0xa4) from [<c0292b24>] (bus_probe_device+0x88/0xac)
|[<c0292b24>] (bus_probe_device+0x88/0xac) from [<c0291490>] (device_add+0x388/0x6c8)
|[<c0291490>] (device_add+0x388/0x6c8) from [<c02952a0>] (platform_device_add+0x188/0x22c)
|[<c02952a0>] (platform_device_add+0x188/0x22c) from [<bf11ea30>] (dsps_probe+0x294/0x394 [musb_dsps])
|[<bf11ea30>] (dsps_probe+0x294/0x394 [musb_dsps]) from [<c0294bf0>] (platform_drv_probe+0x1c/0x24)
|platform musb-hdrc.1.auto: Driver musb-hdrc requests probe deferral
|musb-hdrc musb-hdrc.1.auto: musb_init_controller failed with status -517
This patch moves the init part to earlier part so it can be cleaned as
part of the fail3 label because now it is surrounded by the fail4 label.
Step two is to remove it from musb_free() and add it to the two cleanup
paths (error path and device removal) separately.
Cc: stable@vger.kernel.org
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 | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 0a43329569d1..4d4499b80449 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -1809,7 +1809,6 @@ static void musb_free(struct musb *musb) | |||
1809 | disable_irq_wake(musb->nIrq); | 1809 | disable_irq_wake(musb->nIrq); |
1810 | free_irq(musb->nIrq, musb); | 1810 | free_irq(musb->nIrq, musb); |
1811 | } | 1811 | } |
1812 | cancel_work_sync(&musb->irq_work); | ||
1813 | 1812 | ||
1814 | musb_host_free(musb); | 1813 | musb_host_free(musb); |
1815 | } | 1814 | } |
@@ -1896,6 +1895,9 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
1896 | musb_platform_disable(musb); | 1895 | musb_platform_disable(musb); |
1897 | musb_generic_disable(musb); | 1896 | musb_generic_disable(musb); |
1898 | 1897 | ||
1898 | /* Init IRQ workqueue before request_irq */ | ||
1899 | INIT_WORK(&musb->irq_work, musb_irq_work); | ||
1900 | |||
1899 | /* setup musb parts of the core (especially endpoints) */ | 1901 | /* setup musb parts of the core (especially endpoints) */ |
1900 | status = musb_core_init(plat->config->multipoint | 1902 | status = musb_core_init(plat->config->multipoint |
1901 | ? MUSB_CONTROLLER_MHDRC | 1903 | ? MUSB_CONTROLLER_MHDRC |
@@ -1905,9 +1907,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
1905 | 1907 | ||
1906 | setup_timer(&musb->otg_timer, musb_otg_timer_func, (unsigned long) musb); | 1908 | setup_timer(&musb->otg_timer, musb_otg_timer_func, (unsigned long) musb); |
1907 | 1909 | ||
1908 | /* Init IRQ workqueue before request_irq */ | ||
1909 | INIT_WORK(&musb->irq_work, musb_irq_work); | ||
1910 | |||
1911 | /* attach to the IRQ */ | 1910 | /* attach to the IRQ */ |
1912 | if (request_irq(nIrq, musb->isr, 0, dev_name(dev), musb)) { | 1911 | if (request_irq(nIrq, musb->isr, 0, dev_name(dev), musb)) { |
1913 | dev_err(dev, "request_irq %d failed!\n", nIrq); | 1912 | dev_err(dev, "request_irq %d failed!\n", nIrq); |
@@ -1981,6 +1980,7 @@ fail4: | |||
1981 | musb_host_cleanup(musb); | 1980 | musb_host_cleanup(musb); |
1982 | 1981 | ||
1983 | fail3: | 1982 | fail3: |
1983 | cancel_work_sync(&musb->irq_work); | ||
1984 | if (musb->dma_controller) | 1984 | if (musb->dma_controller) |
1985 | dma_controller_destroy(musb->dma_controller); | 1985 | dma_controller_destroy(musb->dma_controller); |
1986 | fail2_5: | 1986 | fail2_5: |
@@ -2043,6 +2043,7 @@ static int musb_remove(struct platform_device *pdev) | |||
2043 | if (musb->dma_controller) | 2043 | if (musb->dma_controller) |
2044 | dma_controller_destroy(musb->dma_controller); | 2044 | dma_controller_destroy(musb->dma_controller); |
2045 | 2045 | ||
2046 | cancel_work_sync(&musb->irq_work); | ||
2046 | musb_free(musb); | 2047 | musb_free(musb); |
2047 | device_init_wakeup(dev, 0); | 2048 | device_init_wakeup(dev, 0); |
2048 | return 0; | 2049 | return 0; |