diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2017-03-21 21:42:27 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-03-22 20:46:10 +0100 |
commit | 31c7ba9eff5d8a9f20057082eb44cc3c6a1fb3d6 (patch) | |
tree | 0fd02440a47a0bb7dfbe2f09ed682ea67d0d478a /drivers/net/ethernet/synopsys | |
parent | rtnetlink: Add dump all for netconf (diff) | |
download | linux-31c7ba9eff5d8a9f20057082eb44cc3c6a1fb3d6.tar.xz linux-31c7ba9eff5d8a9f20057082eb44cc3c6a1fb3d6.zip |
net: dwc-xlgmac: fix an error code in xlgmac_alloc_pages()
The dma_mapping_error() returns true if there is an error but we want
to return -ENOMEM and not 1.
Fixes: 65e0ace2c5cd ("net: dwc-xlgmac: Initial driver for DesignWare Enterprise Ethernet")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jie Deng <jiedeng@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/synopsys')
-rw-r--r-- | drivers/net/ethernet/synopsys/dwc-xlgmac-desc.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/net/ethernet/synopsys/dwc-xlgmac-desc.c b/drivers/net/ethernet/synopsys/dwc-xlgmac-desc.c index 55c796ed7d26..39b5cb967bba 100644 --- a/drivers/net/ethernet/synopsys/dwc-xlgmac-desc.c +++ b/drivers/net/ethernet/synopsys/dwc-xlgmac-desc.c @@ -335,7 +335,6 @@ static int xlgmac_alloc_pages(struct xlgmac_pdata *pdata, { struct page *pages = NULL; dma_addr_t pages_dma; - int ret; /* Try to obtain pages, decreasing order if necessary */ gfp |= __GFP_COLD | __GFP_COMP | __GFP_NOWARN; @@ -352,10 +351,9 @@ static int xlgmac_alloc_pages(struct xlgmac_pdata *pdata, /* Map the pages */ pages_dma = dma_map_page(pdata->dev, pages, 0, PAGE_SIZE << order, DMA_FROM_DEVICE); - ret = dma_mapping_error(pdata->dev, pages_dma); - if (ret) { + if (dma_mapping_error(pdata->dev, pages_dma)) { put_page(pages); - return ret; + return -ENOMEM; } pa->pages = pages; |