Re: [PATCH] sky2: receive dma mapping error handling

From: Andi Kleen
Date: Tue Feb 02 2010 - 17:44:50 EST


Stephen Hemminger <shemminger@xxxxxxxxxxxxxxxxxxxx> writes:

> - for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
> - re->frag_addr[i] = pci_map_page(pdev,
> +
> +map_page_error:
> + while (--i >= 0) {
> + pci_unmap_page(pdev, re->frag_addr[i],
> + skb_shinfo(skb)->frags[i].size,
> + PCI_DMA_FROMDEVICE);
> + }
> +
> + pci_unmap_single(pdev, re->data_addr, pci_unmap_len(re, data_size),
> + PCI_DMA_FROMDEVICE);

Better add a helper somewhere to do this, doesn't make sense
to duplicate this in all drivers (lots of drivers have similar
problems)

I remember looking at this some time ago but for some reason
the patches never made it out.

-Andi

--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/