Patchwork vxge: use pci_dma_mapping_error to test return value

login
register
mail settings
Submitter Denis Kirjanov
Date Jan. 9, 2010, 7:52 p.m.
Message ID <20100109195222.GA4271@coldcone>
Download mbox | patch
Permalink /patch/42563/
State Accepted
Delegated to: David Miller
Headers show

Comments

Denis Kirjanov - Jan. 9, 2010, 7:52 p.m.
On Fri, Jan 08, 2010 at 00:55 -0800, David Miller wrote:
> From: "Denis Kirjanov <kirjanov@gmail.com" <kirjanov@gmail.com>
> Date: Wed, 6 Jan 2010 00:16:59 +0300
> 
> > @@ -821,7 +821,7 @@ vxge_xmit(struct sk_buff *skb, struct net_device *dev)
> >  	int frg_cnt, first_frg_len;
> >  	skb_frag_t *frag;
> >  	int i = 0, j = 0, avail;
> > -	u64 dma_pointer;
> > +	dma_addr_t dma_pointer;
> >  	struct vxge_tx_priv *txdl_priv = NULL;
> >  	struct __vxge_hw_fifo *fifo_hw;
> >  	int offload_type;
> 
> This will cause build warnings on platforms withe dma_addr_t
> is some type other than "unsigned long long", such as on
> sparc64 where it is a u32.
> 
> This is because of the %ll printf format used to display it
> a few lines down from here.
My mistake. Fixed one.

pci_dma_mapping_error should be used to test return value of
pci_map_single or pci_map_page.

Signed-off-by: Denis Kirjanov <kirjanov@gmail.com>
---

 drivers/net/vxge/vxge-main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Jan. 10, 2010, 9:40 p.m.
From: "Denis Kirjanov <kirjanov@gmail.com" <kirjanov@gmail.com>
Date: Sat, 9 Jan 2010 22:52:22 +0300

> My mistake. Fixed one.
> 
> pci_dma_mapping_error should be used to test return value of
> pci_map_single or pci_map_page.
> 
> Signed-off-by: Denis Kirjanov <kirjanov@gmail.com>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index 0fdfd58..b9685e8 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -310,7 +310,7 @@  static int vxge_rx_map(void *dtrh, struct vxge_ring *ring)
 	dma_addr = pci_map_single(ring->pdev, rx_priv->skb_data,
 				rx_priv->data_size, PCI_DMA_FROMDEVICE);
 
-	if (dma_addr == 0) {
+	if (unlikely(pci_dma_mapping_error(ring->pdev, dma_addr))) {
 		ring->stats.pci_map_fail++;
 		return -EIO;
 	}