summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShuah Khan <shuah.khan@hp.com>2012-07-20 11:50:35 +0000
committerDavid S. Miller <davem@davemloft.net>2012-07-22 23:31:06 -0700
commitec2deec1f3520c467e3fb64f11a5d1e9c073e376 (patch)
tree64f7c991cb5fb9bd207976c3c8da0f14bc0e891d
parent818810472b129004c16fc51bf0a570b60776bfb7 (diff)
niu: Fix to check for dma mapping errors.
Fix Neptune ethernet driver to check dma mapping error after map_page() interface returns. Signed-off-by: Shuah Khan <shuah.khan@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/sun/niu.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
index 8c726b7004d..60d5c035d94 100644
--- a/drivers/net/ethernet/sun/niu.c
+++ b/drivers/net/ethernet/sun/niu.c
@@ -3335,6 +3335,10 @@ static int niu_rbr_add_page(struct niu *np, struct rx_ring_info *rp,
addr = np->ops->map_page(np->device, page, 0,
PAGE_SIZE, DMA_FROM_DEVICE);
+ if (!addr) {
+ __free_page(page);
+ return -ENOMEM;
+ }
niu_hash_page(rp, page, addr);
if (rp->rbr_blocks_per_page > 1)