usb: dwc_otg_310: hcd: avoid to free dma mem if irqs disabled

This patch fix the following warning when plug out
a dm9601 usb ethernet:

WARNING: at include/asm-generic/dma-mapping-common.h:274
Modules linked in: drmboot(P)
CPU: 5 PID: 1501 Comm: kworker/5:2 Tainted: P                4.4.103 #5
Hardware name: Rockchip rk3368 xkp board (DT)
Workqueue: usb_hub_wq hub_event
task: ffffffc0326d4100 task.stack: ffffffc0389fc000
PC is at __DWC_DMA_FREE+0x38/0xa0
LR is at dwc_otg_hcd_qh_free+0xe0/0x120
pc : [<ffffff8008678d60>] lr : [<ffffff8008675b48>] pstate: 204001c5
sp : ffffffc0389ffab0
...
Call trace:
[<ffffff8008678d60>] __DWC_DMA_FREE+0x38/0xa0
[<ffffff8008675b48>] dwc_otg_hcd_qh_free+0xe0/0x120
[<ffffff8008670768>] dwc_otg_hcd_endpoint_disable+0xa4/0xd
[<ffffff8008672538>] endpoint_disable+0x20/0x30
[<ffffff80085ef278>] usb_hcd_disable_endpoint+0x1c/0x24
[<ffffff80085f173c>] usb_disable_endpoint+0x80/0x8c
[<ffffff80085f19a8>] usb_disable_device+0x1f4/0x210
[<ffffff80085e9b08>] usb_disconnect+0x9c/0x1cc
[<ffffff80085eb434>] hub_event+0x740/0xe50
[<ffffff80080b723c>] process_one_work+0x254/0x3f0
[<ffffff80080b7c24>] worker_thread+0x304/0x418
[<ffffff80080bc578>] kthread+0xe8/0xf0
[<ffffff80080828d0>] ret_from_fork+0x10/0x40

Change-Id: I8958bb2a43307d214f7aaaecd337da30b645d8e1
Signed-off-by: William Wu <william.wu@rock-chips.com>
This commit is contained in:
William Wu
2018-03-30 14:26:11 +08:00
committed by Tao Huang
parent 55aaa15dde
commit f5c3dd417f

View File

@@ -71,8 +71,11 @@ void dwc_otg_hcd_qh_free(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh)
buf_size = hcd->core_if->core_params->max_transfer_size;
buf_size = buf_size > 65536 ? 65536 : buf_size;
}
DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags);
DWC_DEV_DMA_FREE(buf_size, qh->dw_align_buf,
qh->dw_align_buf_dma);
DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags);
}
DWC_FREE(qh);