ethernet: aquantia: fix dma_mapping_error test
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 1 Feb 2017 08:52:15 +0000 (11:52 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 1 Feb 2017 17:45:27 +0000 (12:45 -0500)
dma_mapping_error() returns 1 if there is an error and 0 if not.

Fixes: 018423e90bee ("net: ethernet: aquantia: Add ring support code")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/aquantia/atlantic/aq_ring.c

index 817c145520c8b01bead76c507063ac04204c0879..dea9e9bbb8e7ee6d7a095da8938e7d72752d2dd4 100644 (file)
@@ -298,9 +298,10 @@ int aq_ring_rx_fill(struct aq_ring_s *self)
                                        buff->page, 0,
                                        AQ_CFG_RX_FRAME_MAX, DMA_FROM_DEVICE);
 
-               err = dma_mapping_error(aq_nic_get_dev(self->aq_nic), buff->pa);
-               if (err < 0)
+               if (dma_mapping_error(aq_nic_get_dev(self->aq_nic), buff->pa)) {
+                       err = -ENOMEM;
                        goto err_exit;
+               }
 
                buff = NULL;
        }