title: dma_alloc_coherent() returns NULL pointer
body: <p>I'm writing a driver for PCI device for Linux 3.13.3. I am trying to use DMA, but <code>dma_alloc_coherent()</code> always returns <code>NULL</code>. I'm trying to allocate 17 kB of memory (I tried power of two), but it always fails, returning <code>NULL</code> pointer.</p>
  
  <pre class="lang-c prettyprint-override"><code>context-&gt;dma_addr = dma_alloc_coherent(context-&gt;adev-&gt;device, 
          AESDEV_DMA_SIZE, &amp;context-&gt;dma_handle, GFP_KERNEL);
  </code></pre>
  
  <p>And that's how I set up the DMA, everything succeeds there:</p>
  
  <pre class="lang-c prettyprint-override"><code>pci_set_master(pdev);
  
  ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
  if (ret) {
      dev_err(&amp;pdev-&gt;dev, "set_dma_mask failed\n");
      goto setup_dma_failed;
  }
  
  ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
  if (ret) {
      dev_err(&amp;pdev-&gt;dev, "set_consistent_dma_mask failed\n");
      goto setup_dma_failed;
  }
  </code></pre>