diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-05-04 17:35:12 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-05-04 17:35:12 -0400 |
commit | 43b78f1155c868208a413082179251f5fba78153 (patch) | |
tree | d3e9d5117a2c8523fb82033273ba41c5e65277b5 | |
parent | 1a2f474d328f292ee706414824ec4ca690cdf5ba (diff) |
Revert "usb: host: ehci: Use dma_pool_zalloc()"
This reverts commit 22072e83ebd510fb6a090aef9d65ccfda9b1e7e4 as it is
broken.
Alan writes:
What you can't see just from reading the patch is that in both
cases (ehci->itd_pool and ehci->sitd_pool) there are two
allocation paths -- the two branches of an "if" statement -- and
only one of the paths calls dma_pool_[z]alloc. However, the
memset is needed for both paths, and so it can't be eliminated.
Given that it must be present, there's no advantage to calling
dma_pool_zalloc rather than dma_pool_alloc.
Reported-by: Erick Cafferata <erick@cafferata.me>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Souptick Joarder <jrdr.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/host/ehci-mem.c | 3 | ||||
-rw-r--r-- | drivers/usb/host/ehci-sched.c | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c index 4c6c08b675b5..21307d862af6 100644 --- a/drivers/usb/host/ehci-mem.c +++ b/drivers/usb/host/ehci-mem.c | |||
@@ -73,9 +73,10 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags) | |||
73 | if (!qh) | 73 | if (!qh) |
74 | goto done; | 74 | goto done; |
75 | qh->hw = (struct ehci_qh_hw *) | 75 | qh->hw = (struct ehci_qh_hw *) |
76 | dma_pool_zalloc(ehci->qh_pool, flags, &dma); | 76 | dma_pool_alloc(ehci->qh_pool, flags, &dma); |
77 | if (!qh->hw) | 77 | if (!qh->hw) |
78 | goto fail; | 78 | goto fail; |
79 | memset(qh->hw, 0, sizeof *qh->hw); | ||
79 | qh->qh_dma = dma; | 80 | qh->qh_dma = dma; |
80 | // INIT_LIST_HEAD (&qh->qh_list); | 81 | // INIT_LIST_HEAD (&qh->qh_list); |
81 | INIT_LIST_HEAD (&qh->qtd_list); | 82 | INIT_LIST_HEAD (&qh->qtd_list); |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index 28e2a338b481..e56db44708bc 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -1287,7 +1287,7 @@ itd_urb_transaction( | |||
1287 | } else { | 1287 | } else { |
1288 | alloc_itd: | 1288 | alloc_itd: |
1289 | spin_unlock_irqrestore(&ehci->lock, flags); | 1289 | spin_unlock_irqrestore(&ehci->lock, flags); |
1290 | itd = dma_pool_zalloc(ehci->itd_pool, mem_flags, | 1290 | itd = dma_pool_alloc(ehci->itd_pool, mem_flags, |
1291 | &itd_dma); | 1291 | &itd_dma); |
1292 | spin_lock_irqsave(&ehci->lock, flags); | 1292 | spin_lock_irqsave(&ehci->lock, flags); |
1293 | if (!itd) { | 1293 | if (!itd) { |
@@ -1297,6 +1297,7 @@ itd_urb_transaction( | |||
1297 | } | 1297 | } |
1298 | } | 1298 | } |
1299 | 1299 | ||
1300 | memset(itd, 0, sizeof(*itd)); | ||
1300 | itd->itd_dma = itd_dma; | 1301 | itd->itd_dma = itd_dma; |
1301 | itd->frame = NO_FRAME; | 1302 | itd->frame = NO_FRAME; |
1302 | list_add(&itd->itd_list, &sched->td_list); | 1303 | list_add(&itd->itd_list, &sched->td_list); |
@@ -2080,7 +2081,7 @@ sitd_urb_transaction( | |||
2080 | } else { | 2081 | } else { |
2081 | alloc_sitd: | 2082 | alloc_sitd: |
2082 | spin_unlock_irqrestore(&ehci->lock, flags); | 2083 | spin_unlock_irqrestore(&ehci->lock, flags); |
2083 | sitd = dma_pool_zalloc(ehci->sitd_pool, mem_flags, | 2084 | sitd = dma_pool_alloc(ehci->sitd_pool, mem_flags, |
2084 | &sitd_dma); | 2085 | &sitd_dma); |
2085 | spin_lock_irqsave(&ehci->lock, flags); | 2086 | spin_lock_irqsave(&ehci->lock, flags); |
2086 | if (!sitd) { | 2087 | if (!sitd) { |
@@ -2090,6 +2091,7 @@ sitd_urb_transaction( | |||
2090 | } | 2091 | } |
2091 | } | 2092 | } |
2092 | 2093 | ||
2094 | memset(sitd, 0, sizeof(*sitd)); | ||
2093 | sitd->sitd_dma = sitd_dma; | 2095 | sitd->sitd_dma = sitd_dma; |
2094 | sitd->frame = NO_FRAME; | 2096 | sitd->frame = NO_FRAME; |
2095 | list_add(&sitd->sitd_list, &iso_sched->td_list); | 2097 | list_add(&sitd->sitd_list, &iso_sched->td_list); |