diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-06 08:37:39 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-06 08:37:39 -0700 |
commit | bbfdbe9dc00dc3fd6cba9b0f96adc46d025c9079 (patch) | |
tree | 578a2c07181a1832eea2dd4195b6ff2fcebf4c83 /drivers/dma | |
parent | 722154e4cacf015161efe60009ae9be23d492296 (diff) | |
parent | 8bed90557d2600d25e58de30df48b244980164ec (diff) | |
download | op-kernel-dev-bbfdbe9dc00dc3fd6cba9b0f96adc46d025c9079.zip op-kernel-dev-bbfdbe9dc00dc3fd6cba9b0f96adc46d025c9079.tar.gz |
Merge branch 'sh/for-2.6.34' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* 'sh/for-2.6.34' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6:
sh: fix a number of Oopses and leaks in SH framebuffer driver
SH: fix error paths in DMA driver
sh: sh7751 pci controller io port fix
sh: Fix maximum number of SCIF ports in R2D defconfigs
SH: fix TS field shift calculation for DMA drivers
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/shdma.c | 27 |
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; } /* |