net/sonic: Use dma_mapping_error()
authorFinn Thain <fthain@telegraphics.com.au>
Wed, 30 May 2018 03:03:51 +0000 (13:03 +1000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 31 May 2018 18:17:33 +0000 (14:17 -0400)
With CONFIG_DMA_API_DEBUG=y, calling sonic_open() produces the
message, "DMA-API: device driver failed to check map error".
Add the missing dma_mapping_error() call.

Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/natsemi/sonic.c

index 7ed08486ae23aadf1ce6710d343a892a41d1fa30..c805dcbebd0278752b2ed8b34b7531ec19ea2357 100644 (file)
@@ -84,7 +84,7 @@ static int sonic_open(struct net_device *dev)
        for (i = 0; i < SONIC_NUM_RRS; i++) {
                dma_addr_t laddr = dma_map_single(lp->device, skb_put(lp->rx_skb[i], SONIC_RBSIZE),
                                                  SONIC_RBSIZE, DMA_FROM_DEVICE);
-               if (!laddr) {
+               if (dma_mapping_error(lp->device, laddr)) {
                        while(i > 0) { /* free any that were mapped successfully */
                                i--;
                                dma_unmap_single(lp->device, lp->rx_laddr[i], SONIC_RBSIZE, DMA_FROM_DEVICE);