If the attempt to map a page for DMA fails (eg, because we're out of
mapping space) then we must not hold on to the page we allocated for
DMA - doing so will result in a memory leak.
Cc: <[email protected]>
Reported-by: Bryan Phillippe <[email protected]>
Tested-by: Bryan Phillippe <[email protected]>
Signed-off-by: Russell King <[email protected]>
if (addr)
*handle = pfn_to_dma(dev, page_to_pfn(page));
+ else
+ __dma_free_buffer(page, size);
return addr;
}