Re: [PATCH] net: dl2k: switch from 'pci_' to 'dma_' API

From: Christophe JAILLET
Date: Sun Sep 13 2020 - 06:45:42 EST


Le 13/09/2020 à 08:55, Leon Romanovsky a écrit :
On Sun, Sep 13, 2020 at 08:14:17AM +0200, Christophe JAILLET wrote:
> [...]
@@ -504,9 +510,8 @@ static int alloc_list(struct net_device *dev)
sizeof(struct netdev_desc));
/* Rubicon now supports 40 bits of addressing space. */
np->rx_ring[i].fraginfo =
- cpu_to_le64(pci_map_single(
- np->pdev, skb->data, np->rx_buf_sz,
- PCI_DMA_FROMDEVICE));
+ cpu_to_le64(dma_map_single(&np->pdev->dev, skb->data,
+ np->rx_buf_sz, DMA_FROM_DEVICE));

I'm aware that this was before, but both pci_map_single and
dma_map_single return an ERROR and it is wrong to set .fraginfo without
checking result.

Thanks

Hi,

Nice catch.

I'll try to send patches for such patterns as some follow-ups.
It can be found in several drivers.

But anyone who want to fix it faster than me is welcome ;-)

CJ