Commit b24dbfe9 authored by YueHaibing's avatar YueHaibing Committed by David S. Miller

amd-xgbe: use dma_mapping_error to check map errors

The dma_mapping_error() returns true or false, but we want
to return -ENOMEM if there was an error.

Fixes: 174fd259 ("amd-xgbe: Implement split header receive support")
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 756cd366
...@@ -289,7 +289,7 @@ static int xgbe_alloc_pages(struct xgbe_prv_data *pdata, ...@@ -289,7 +289,7 @@ static int xgbe_alloc_pages(struct xgbe_prv_data *pdata,
struct page *pages = NULL; struct page *pages = NULL;
dma_addr_t pages_dma; dma_addr_t pages_dma;
gfp_t gfp; gfp_t gfp;
int order, ret; int order;
again: again:
order = alloc_order; order = alloc_order;
...@@ -316,10 +316,9 @@ static int xgbe_alloc_pages(struct xgbe_prv_data *pdata, ...@@ -316,10 +316,9 @@ static int xgbe_alloc_pages(struct xgbe_prv_data *pdata,
/* Map the pages */ /* Map the pages */
pages_dma = dma_map_page(pdata->dev, pages, 0, pages_dma = dma_map_page(pdata->dev, pages, 0,
PAGE_SIZE << order, DMA_FROM_DEVICE); PAGE_SIZE << order, DMA_FROM_DEVICE);
ret = dma_mapping_error(pdata->dev, pages_dma); if (dma_mapping_error(pdata->dev, pages_dma)) {
if (ret) {
put_page(pages); put_page(pages);
return ret; return -ENOMEM;
} }
pa->pages = pages; pa->pages = pages;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment