summaryrefslogtreecommitdiff
path: root/drivers/dma
diff options
context:
space:
mode:
authorJonas Aaberg <jonas.aberg@stericsson.com>2010-06-20 21:25:15 +0000
committerDan Williams <dan.j.williams@intel.com>2010-06-22 18:01:54 -0700
commitff0b12baa50390ba6a963cb6f6162a94ed4fc333 (patch)
treefd2604e67ffa4595ffc0fb33a95a2634b44805d8 /drivers/dma
parentc675b1b424446b52de00cad84ca3d823d29a3d0e (diff)
downloadlinux-3.10-ff0b12baa50390ba6a963cb6f6162a94ed4fc333.tar.gz
linux-3.10-ff0b12baa50390ba6a963cb6f6162a94ed4fc333.tar.bz2
linux-3.10-ff0b12baa50390ba6a963cb6f6162a94ed4fc333.zip
DMAENGINE: ste_dma40: improve allocation error handling
Better error handling when channel allocation fails. Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/ste_dma40.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index b60a6dbf1e0..8ed154779bb 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -1239,7 +1239,7 @@ static int d40_free_dma(struct d40_chan *d40c)
res = d40_channel_execute_command(d40c, D40_DMA_SUSPEND_REQ);
if (res) {
- dev_err(&d40c->chan.dev->device, "[%s] suspend\n",
+ dev_err(&d40c->chan.dev->device, "[%s] suspend failed\n",
__func__);
return res;
}
@@ -1657,8 +1657,12 @@ static int d40_alloc_chan_resources(struct dma_chan *chan)
*/
if (d40c->dma_cfg.channel_type == 0) {
err = d40_config_memcpy(d40c);
- if (err)
- goto err_alloc;
+ if (err) {
+ dev_err(&d40c->chan.dev->device,
+ "[%s] Failed to configure memcpy channel\n",
+ __func__);
+ goto fail;
+ }
}
is_free_phy = (d40c->phy_chan == NULL);
@@ -1666,7 +1670,7 @@ static int d40_alloc_chan_resources(struct dma_chan *chan)
if (err) {
dev_err(&d40c->chan.dev->device,
"[%s] Failed to allocate channel\n", __func__);
- goto err_alloc;
+ goto fail;
}
/* Fill in basic CFG register values */
@@ -1699,17 +1703,9 @@ static int d40_alloc_chan_resources(struct dma_chan *chan)
__func__);
}
}
-
+fail:
spin_unlock_irqrestore(&d40c->lock, flags);
- return 0;
-
- err_config:
- (void) d40_free_dma(d40c);
- err_alloc:
- spin_unlock_irqrestore(&d40c->lock, flags);
- dev_err(&d40c->chan.dev->device,
- "[%s] Channel allocation failed\n", __func__);
- return -EINVAL;
+ return err;
}
static void d40_free_chan_resources(struct dma_chan *chan)