diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-04-26 16:08:27 +0900 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-04-26 16:08:27 +0900 |
commit | e19553427c2e8fdb04fdd98e407164bb59a840ba (patch) | |
tree | 5332234b2dad07c03c27e4608afb16f297f41e61 /drivers/dma/shdma.c | |
parent | 35f6cd4a06432034665a1499ca4b022437423aac (diff) | |
parent | 83515bc7df812555e20cda48614674e2f346f9f5 (diff) | |
download | linux-e19553427c2e8fdb04fdd98e407164bb59a840ba.tar.bz2 |
Merge branch 'sh/stable-updates'
Conflicts:
arch/sh/kernel/dwarf.c
drivers/dma/shdma.c
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/dma/shdma.c')
-rw-r--r-- | drivers/dma/shdma.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index aab352a63a4a..323afef77802 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c @@ -19,6 +19,7 @@ #include <linux/init.h> #include <linux/module.h> +#include <linux/slab.h> #include <linux/interrupt.h> #include <linux/dmaengine.h> #include <linux/delay.h> @@ -288,6 +289,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); @@ -299,11 +301,15 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan) const struct sh_dmae_slave_config *cfg; cfg = sh_dmae_find_slave(sh_chan, param); - 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; @@ -332,10 +338,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; } /* |