aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/ste_dma40.c
diff options
context:
space:
mode:
authorJonas Aaberg <jonas.aberg@stericsson.com>2010-06-20 17:25:15 -0400
committerDan Williams <dan.j.williams@intel.com>2010-06-22 21:01:54 -0400
commitff0b12baa50390ba6a963cb6f6162a94ed4fc333 (patch)
treefd2604e67ffa4595ffc0fb33a95a2634b44805d8 /drivers/dma/ste_dma40.c
parentc675b1b424446b52de00cad84ca3d823d29a3d0e (diff)
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/ste_dma40.c')
-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 b60a6dbf1e09..8ed154779bbf 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)
1239 1239
1240 res = d40_channel_execute_command(d40c, D40_DMA_SUSPEND_REQ); 1240 res = d40_channel_execute_command(d40c, D40_DMA_SUSPEND_REQ);
1241 if (res) { 1241 if (res) {
1242 dev_err(&d40c->chan.dev->device, "[%s] suspend\n", 1242 dev_err(&d40c->chan.dev->device, "[%s] suspend failed\n",
1243 __func__); 1243 __func__);
1244 return res; 1244 return res;
1245 } 1245 }
@@ -1657,8 +1657,12 @@ static int d40_alloc_chan_resources(struct dma_chan *chan)
1657 */ 1657 */
1658 if (d40c->dma_cfg.channel_type == 0) { 1658 if (d40c->dma_cfg.channel_type == 0) {
1659 err = d40_config_memcpy(d40c); 1659 err = d40_config_memcpy(d40c);
1660 if (err) 1660 if (err) {
1661 goto err_alloc; 1661 dev_err(&d40c->chan.dev->device,
1662 "[%s] Failed to configure memcpy channel\n",
1663 __func__);
1664 goto fail;
1665 }
1662 } 1666 }
1663 is_free_phy = (d40c->phy_chan == NULL); 1667 is_free_phy = (d40c->phy_chan == NULL);
1664 1668
@@ -1666,7 +1670,7 @@ static int d40_alloc_chan_resources(struct dma_chan *chan)
1666 if (err) { 1670 if (err) {
1667 dev_err(&d40c->chan.dev->device, 1671 dev_err(&d40c->chan.dev->device,
1668 "[%s] Failed to allocate channel\n", __func__); 1672 "[%s] Failed to allocate channel\n", __func__);
1669 goto err_alloc; 1673 goto fail;
1670 } 1674 }
1671 1675
1672 /* Fill in basic CFG register values */ 1676 /* Fill in basic CFG register values */
@@ -1699,17 +1703,9 @@ static int d40_alloc_chan_resources(struct dma_chan *chan)
1699 __func__); 1703 __func__);
1700 } 1704 }
1701 } 1705 }
1702 1706fail:
1703 spin_unlock_irqrestore(&d40c->lock, flags); 1707 spin_unlock_irqrestore(&d40c->lock, flags);
1704 return 0; 1708 return err;
1705
1706 err_config:
1707 (void) d40_free_dma(d40c);
1708 err_alloc:
1709 spin_unlock_irqrestore(&d40c->lock, flags);
1710 dev_err(&d40c->chan.dev->device,
1711 "[%s] Channel allocation failed\n", __func__);
1712 return -EINVAL;
1713} 1709}
1714 1710
1715static void d40_free_chan_resources(struct dma_chan *chan) 1711static void d40_free_chan_resources(struct dma_chan *chan)