diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/host/ehci-sched.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index 38c606c13db1..e3cfe0a03552 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -1181,21 +1181,18 @@ itd_urb_transaction ( | |||
1181 | struct ehci_itd, itd_list); | 1181 | struct ehci_itd, itd_list); |
1182 | list_del (&itd->itd_list); | 1182 | list_del (&itd->itd_list); |
1183 | itd_dma = itd->itd_dma; | 1183 | itd_dma = itd->itd_dma; |
1184 | } else | 1184 | } else { |
1185 | itd = NULL; | ||
1186 | |||
1187 | if (!itd) { | ||
1188 | spin_unlock_irqrestore (&ehci->lock, flags); | 1185 | spin_unlock_irqrestore (&ehci->lock, flags); |
1189 | itd = dma_pool_alloc (ehci->itd_pool, mem_flags, | 1186 | itd = dma_pool_alloc (ehci->itd_pool, mem_flags, |
1190 | &itd_dma); | 1187 | &itd_dma); |
1191 | spin_lock_irqsave (&ehci->lock, flags); | 1188 | spin_lock_irqsave (&ehci->lock, flags); |
1189 | if (!itd) { | ||
1190 | iso_sched_free(stream, sched); | ||
1191 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
1192 | return -ENOMEM; | ||
1193 | } | ||
1192 | } | 1194 | } |
1193 | 1195 | ||
1194 | if (unlikely (NULL == itd)) { | ||
1195 | iso_sched_free (stream, sched); | ||
1196 | spin_unlock_irqrestore (&ehci->lock, flags); | ||
1197 | return -ENOMEM; | ||
1198 | } | ||
1199 | memset (itd, 0, sizeof *itd); | 1196 | memset (itd, 0, sizeof *itd); |
1200 | itd->itd_dma = itd_dma; | 1197 | itd->itd_dma = itd_dma; |
1201 | list_add (&itd->itd_list, &sched->td_list); | 1198 | list_add (&itd->itd_list, &sched->td_list); |
@@ -1814,21 +1811,18 @@ sitd_urb_transaction ( | |||
1814 | struct ehci_sitd, sitd_list); | 1811 | struct ehci_sitd, sitd_list); |
1815 | list_del (&sitd->sitd_list); | 1812 | list_del (&sitd->sitd_list); |
1816 | sitd_dma = sitd->sitd_dma; | 1813 | sitd_dma = sitd->sitd_dma; |
1817 | } else | 1814 | } else { |
1818 | sitd = NULL; | ||
1819 | |||
1820 | if (!sitd) { | ||
1821 | spin_unlock_irqrestore (&ehci->lock, flags); | 1815 | spin_unlock_irqrestore (&ehci->lock, flags); |
1822 | sitd = dma_pool_alloc (ehci->sitd_pool, mem_flags, | 1816 | sitd = dma_pool_alloc (ehci->sitd_pool, mem_flags, |
1823 | &sitd_dma); | 1817 | &sitd_dma); |
1824 | spin_lock_irqsave (&ehci->lock, flags); | 1818 | spin_lock_irqsave (&ehci->lock, flags); |
1819 | if (!sitd) { | ||
1820 | iso_sched_free(stream, iso_sched); | ||
1821 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
1822 | return -ENOMEM; | ||
1823 | } | ||
1825 | } | 1824 | } |
1826 | 1825 | ||
1827 | if (!sitd) { | ||
1828 | iso_sched_free (stream, iso_sched); | ||
1829 | spin_unlock_irqrestore (&ehci->lock, flags); | ||
1830 | return -ENOMEM; | ||
1831 | } | ||
1832 | memset (sitd, 0, sizeof *sitd); | 1826 | memset (sitd, 0, sizeof *sitd); |
1833 | sitd->sitd_dma = sitd_dma; | 1827 | sitd->sitd_dma = sitd_dma; |
1834 | list_add (&sitd->sitd_list, &iso_sched->td_list); | 1828 | list_add (&sitd->sitd_list, &iso_sched->td_list); |