summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/ti/davinci_cpdma.c
diff options
context:
space:
mode:
authorSebastian Siewior <bigeasy@linutronix.de>2013-06-20 16:58:45 +0200
committerDavid S. Miller <davem@davemloft.net>2013-06-24 00:07:30 -0700
commit14bd076955f4e9cb911326d1b7291e3a2b40bdec (patch)
tree13ebc4335959adc0abe2ea414a77107c8a0acbe7 /drivers/net/ethernet/ti/davinci_cpdma.c
parentdb4e9b2b98bac7adc7657ef94bb6d1a419a35571 (diff)
downloadop-kernel-dev-14bd076955f4e9cb911326d1b7291e3a2b40bdec.zip
op-kernel-dev-14bd076955f4e9cb911326d1b7291e3a2b40bdec.tar.gz
net: eth: davicnci_cpdma: check dma map error
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ti/davinci_cpdma.c')
-rw-r--r--drivers/net/ethernet/ti/davinci_cpdma.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
index 49dfd592..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);
OpenPOWER on IntegriCloud