Skip to content

Commit

Permalink
net: ethernet: micrel: fix an error code
Browse files Browse the repository at this point in the history
The dma_mapping_error() function returns true or false.  We should
return -ENOMEM if it there is a dma mapping error.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Aug 17, 2015
1 parent 8cb775b commit 2902bc6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/net/ethernet/micrel/ks8842.c
Original file line number Diff line number Diff line change
Expand Up @@ -952,9 +952,8 @@ static int ks8842_alloc_dma_bufs(struct net_device *netdev)

sg_dma_address(&tx_ctl->sg) = dma_map_single(adapter->dev,
tx_ctl->buf, DMA_BUFFER_SIZE, DMA_TO_DEVICE);
err = dma_mapping_error(adapter->dev,
sg_dma_address(&tx_ctl->sg));
if (err) {
if (dma_mapping_error(adapter->dev, sg_dma_address(&tx_ctl->sg))) {
err = -ENOMEM;
sg_dma_address(&tx_ctl->sg) = 0;
goto err;
}
Expand Down

0 comments on commit 2902bc6

Please sign in to comment.