From: Xi Wang Date: Thu, 29 Nov 2012 03:18:14 +0000 (+1100) Subject: drivers/usb/gadget/amd5536udc.c: avoid calling dma_pool_create() with NULL dev X-Git-Tag: next-20121205~1^2~216 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=feb1d96a914905c57d6ae382920f876315d3ff06;p=karo-tx-linux.git drivers/usb/gadget/amd5536udc.c: avoid calling dma_pool_create() with NULL dev Calling dma_pool_create() with dev==NULL will oops on a NUMA machine. Rather than changing dma_pool_create() we wish to disallow passing dev==NULL. This requires fixing up the small number of drivers which are passing in dev==NULL. Use &dev->pdev->dev instead of NULL. Signed-off-by: Xi Wang Cc: Felipe Balbi Cc: Greg KH Signed-off-by: Andrew Morton --- diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c index fc0ec5e0d58e..ba6f2a1f5fd3 100644 --- a/drivers/usb/gadget/amd5536udc.c +++ b/drivers/usb/gadget/amd5536udc.c @@ -3133,7 +3133,7 @@ static int init_dma_pools(struct udc *dev) } /* DMA setup */ - dev->data_requests = dma_pool_create("data_requests", NULL, + dev->data_requests = dma_pool_create("data_requests", &dev->pdev->dev, sizeof(struct udc_data_dma), 0, 0); if (!dev->data_requests) { DBG(dev, "can't get request data pool\n"); @@ -3145,7 +3145,7 @@ static int init_dma_pools(struct udc *dev) dev->ep[UDC_EP0IN_IX].dma = &dev->regs->ctl; /* dma desc for setup data */ - dev->stp_requests = dma_pool_create("setup requests", NULL, + dev->stp_requests = dma_pool_create("setup requests", &dev->pdev->dev, sizeof(struct udc_stp_dma), 0, 0); if (!dev->stp_requests) { DBG(dev, "can't get stp request pool\n"); @@ -3266,6 +3266,12 @@ static int udc_pci_probe( pci_set_master(pdev); pci_try_set_mwi(pdev); + dev->phys_addr = resource; + dev->irq = pdev->irq; + dev->pdev = pdev; + dev->gadget.dev.parent = &pdev->dev; + dev->gadget.dev.dma_mask = pdev->dev.dma_mask; + /* init dma pools */ if (use_dma) { retval = init_dma_pools(dev); @@ -3273,12 +3279,6 @@ static int udc_pci_probe( goto finished; } - dev->phys_addr = resource; - dev->irq = pdev->irq; - dev->pdev = pdev; - dev->gadget.dev.parent = &pdev->dev; - dev->gadget.dev.dma_mask = pdev->dev.dma_mask; - /* general probing */ if (udc_probe(dev) == 0) return 0;