All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: eth: davicnci_cpdma: check dma map error
@ 2013-06-20 14:58 Sebastian Andrzej Siewior
  2013-06-24  7:07 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Andrzej Siewior @ 2013-06-20 14:58 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Sebastian Andrzej Siewior, Mugunthan V N

Since the DMA mapping may fail the caller should check the return value.

Cc: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/net/ethernet/ti/davinci_cpdma.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
index 49dfd59..053c84f 100644
--- a/drivers/net/ethernet/ti/davinci_cpdma.c
+++ b/drivers/net/ethernet/ti/davinci_cpdma.c
@@ -705,6 +705,13 @@ int cpdma_chan_submit(struct cpdma_chan *chan, void *token, void *data,
 	}
 
 	buffer = dma_map_single(ctlr->dev, data, len, chan->dir);
+	ret = dma_mapping_error(ctlr->dev, buffer);
+	if (ret) {
+		cpdma_desc_free(ctlr->pool, desc, 1);
+		ret = -EINVAL;
+		goto unlock_ret;
+	}
+
 	mode = CPDMA_DESC_OWNER | CPDMA_DESC_SOP | CPDMA_DESC_EOP;
 	cpdma_desc_to_port(chan, mode, directed);
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: eth: davicnci_cpdma: check dma map error
  2013-06-20 14:58 [PATCH] net: eth: davicnci_cpdma: check dma map error Sebastian Andrzej Siewior
@ 2013-06-24  7:07 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-06-24  7:07 UTC (permalink / raw)
  To: bigeasy; +Cc: netdev, mugunthanvnm

From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Thu, 20 Jun 2013 16:58:45 +0200

> Since the DMA mapping may fail the caller should check the return value.
> 
> Cc: Mugunthan V N <mugunthanvnm@ti.com>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-24  7:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-20 14:58 [PATCH] net: eth: davicnci_cpdma: check dma map error Sebastian Andrzej Siewior
2013-06-24  7:07 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.