Skip to content

Commit 4107b87

Browse files
Zhang Changzhongkuba-moo
authored andcommitted
net/sonic: use dma_mapping_error() for error check
The DMA address returned by dma_map_single() should be checked with dma_mapping_error(). Fix it accordingly. Fixes: efcce83 ("[PATCH] macsonic/jazzsonic network drivers update") Signed-off-by: Zhang Changzhong <[email protected]> Tested-by: Stan Johnson <[email protected]> Signed-off-by: Finn Thain <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Link: https://lore.kernel.org/r/6645a4b5c1e364312103f48b7b36783b94e197a2.1679370343.git.fthain@linux-m68k.org Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 82463d9 commit 4107b87

File tree

1 file changed

+2
-2
lines changed
  • drivers/net/ethernet/natsemi

1 file changed

+2
-2
lines changed

drivers/net/ethernet/natsemi/sonic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev)
292292
*/
293293

294294
laddr = dma_map_single(lp->device, skb->data, length, DMA_TO_DEVICE);
295-
if (!laddr) {
295+
if (dma_mapping_error(lp->device, laddr)) {
296296
pr_err_ratelimited("%s: failed to map tx DMA buffer.\n", dev->name);
297297
dev_kfree_skb_any(skb);
298298
return NETDEV_TX_OK;
@@ -509,7 +509,7 @@ static bool sonic_alloc_rb(struct net_device *dev, struct sonic_local *lp,
509509

510510
*new_addr = dma_map_single(lp->device, skb_put(*new_skb, SONIC_RBSIZE),
511511
SONIC_RBSIZE, DMA_FROM_DEVICE);
512-
if (!*new_addr) {
512+
if (dma_mapping_error(lp->device, *new_addr)) {
513513
dev_kfree_skb(*new_skb);
514514
*new_skb = NULL;
515515
return false;

0 commit comments

Comments
 (0)