Skip to content

Commit 43b78f1

Browse files
committed
Revert "usb: host: ehci: Use dma_pool_zalloc()"
This reverts commit 22072e8 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 <[email protected]> Cc: Alan Stern <[email protected]> Cc: Souptick Joarder <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1a2f474 commit 43b78f1

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

drivers/usb/host/ehci-mem.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags)
7373
if (!qh)
7474
goto done;
7575
qh->hw = (struct ehci_qh_hw *)
76-
dma_pool_zalloc(ehci->qh_pool, flags, &dma);
76+
dma_pool_alloc(ehci->qh_pool, flags, &dma);
7777
if (!qh->hw)
7878
goto fail;
79+
memset(qh->hw, 0, sizeof *qh->hw);
7980
qh->qh_dma = dma;
8081
// INIT_LIST_HEAD (&qh->qh_list);
8182
INIT_LIST_HEAD (&qh->qtd_list);

drivers/usb/host/ehci-sched.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,7 @@ itd_urb_transaction(
12871287
} else {
12881288
alloc_itd:
12891289
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,
12911291
&itd_dma);
12921292
spin_lock_irqsave(&ehci->lock, flags);
12931293
if (!itd) {
@@ -1297,6 +1297,7 @@ itd_urb_transaction(
12971297
}
12981298
}
12991299

1300+
memset(itd, 0, sizeof(*itd));
13001301
itd->itd_dma = itd_dma;
13011302
itd->frame = NO_FRAME;
13021303
list_add(&itd->itd_list, &sched->td_list);
@@ -2080,7 +2081,7 @@ sitd_urb_transaction(
20802081
} else {
20812082
alloc_sitd:
20822083
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,
20842085
&sitd_dma);
20852086
spin_lock_irqsave(&ehci->lock, flags);
20862087
if (!sitd) {
@@ -2090,6 +2091,7 @@ sitd_urb_transaction(
20902091
}
20912092
}
20922093

2094+
memset(sitd, 0, sizeof(*sitd));
20932095
sitd->sitd_dma = sitd_dma;
20942096
sitd->frame = NO_FRAME;
20952097
list_add(&sitd->sitd_list, &iso_sched->td_list);

0 commit comments

Comments
 (0)