aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/shdma.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2010-06-08 20:05:18 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2010-06-08 20:05:18 -0400
commit44b56603c4c476b845a824cff6fe905c6268b2a1 (patch)
treeb7e792414fef2390718a657765719fbbb529ce84 /drivers/dma/shdma.c
parentc3935e30495869dd611e1cd62253c94ebc7c6c04 (diff)
parentb160fdabe93a8a53094f90f02bf4dcb500782aab (diff)
downloadkernel_samsung_smdk4412-44b56603c4c476b845a824cff6fe905c6268b2a1.zip
kernel_samsung_smdk4412-44b56603c4c476b845a824cff6fe905c6268b2a1.tar.gz
kernel_samsung_smdk4412-44b56603c4c476b845a824cff6fe905c6268b2a1.tar.bz2
Merge branch 'for-2.6.34-incoming' into for-2.6.35-incoming
Diffstat (limited to 'drivers/dma/shdma.c')
-rw-r--r--drivers/dma/shdma.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index 7cc31b3..6f25a20 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -290,6 +290,7 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
struct sh_dmae_chan *sh_chan = to_sh_chan(chan);
struct sh_desc *desc;
struct sh_dmae_slave *param = chan->private;
+ int ret;
pm_runtime_get_sync(sh_chan->dev);
@@ -301,11 +302,15 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
struct sh_dmae_slave_config *cfg;
cfg = sh_dmae_find_slave(sh_chan, param->slave_id);
- if (!cfg)
- return -EINVAL;
+ if (!cfg) {
+ ret = -EINVAL;
+ goto efindslave;
+ }
- if (test_and_set_bit(param->slave_id, sh_dmae_slave_used))
- return -EBUSY;
+ if (test_and_set_bit(param->slave_id, sh_dmae_slave_used)) {
+ ret = -EBUSY;
+ goto etestused;
+ }
param->config = cfg;
@@ -334,10 +339,20 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
}
spin_unlock_bh(&sh_chan->desc_lock);
- if (!sh_chan->descs_allocated)
- pm_runtime_put(sh_chan->dev);
+ if (!sh_chan->descs_allocated) {
+ ret = -ENOMEM;
+ goto edescalloc;
+ }
return sh_chan->descs_allocated;
+
+edescalloc:
+ if (param)
+ clear_bit(param->slave_id, sh_dmae_slave_used);
+etestused:
+efindslave:
+ pm_runtime_put(sh_chan->dev);
+ return ret;
}
/*