Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / usb / host / ehci-mem.c
index 5c38ad8..766061e 100644 (file)
@@ -45,7 +45,7 @@ static inline void ehci_qtd_init (struct ehci_qtd *qtd, dma_addr_t dma)
        INIT_LIST_HEAD (&qtd->qtd_list);
 }
 
-static struct ehci_qtd *ehci_qtd_alloc (struct ehci_hcd *ehci, int flags)
+static struct ehci_qtd *ehci_qtd_alloc (struct ehci_hcd *ehci, gfp_t flags)
 {
        struct ehci_qtd         *qtd;
        dma_addr_t              dma;
@@ -75,11 +75,10 @@ static void qh_destroy (struct kref *kref)
        }
        if (qh->dummy)
                ehci_qtd_free (ehci, qh->dummy);
-       usb_put_dev (qh->dev);
        dma_pool_free (ehci->qh_pool, qh, qh->qh_dma);
 }
 
-static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, int flags)
+static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags)
 {
        struct ehci_qh          *qh;
        dma_addr_t              dma;
@@ -161,7 +160,7 @@ static void ehci_mem_cleanup (struct ehci_hcd *ehci)
 }
 
 /* remember to add cleanup code (above) if you add anything here */
-static int ehci_mem_init (struct ehci_hcd *ehci, int flags)
+static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags)
 {
        int i;
 
@@ -221,13 +220,9 @@ static int ehci_mem_init (struct ehci_hcd *ehci, int flags)
                ehci->periodic [i] = EHCI_LIST_END;
 
        /* software shadow of hardware table */
-       ehci->pshadow = kmalloc (ehci->periodic_size * sizeof (void *), flags);
-       if (ehci->pshadow == NULL) {
-               goto fail;
-       }
-       memset (ehci->pshadow, 0, ehci->periodic_size * sizeof (void *));
-
-       return 0;
+       ehci->pshadow = kcalloc(ehci->periodic_size, sizeof(void *), flags);
+       if (ehci->pshadow != NULL)
+               return 0;
 
 fail:
        ehci_dbg (ehci, "couldn't init memory\n");