aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorRamax Lo <ramaxlo@gmail.com>2009-12-08 23:42:41 +0800
committerBen Dooks <ben-linux@fluff.org>2009-12-08 23:09:05 +0000
commit947a2462792a89b8aa168a1108288e0d0ae36d12 (patch)
tree7f81e692fad20b9a2de0cd759dcb750da9e9cc65 /arch
parent93b0d8c6b67b7d337509a36dbfcdb6d6eac1ef12 (diff)
ARM: S3C24XX: DMA: Use valid index when accessing array
The DMA_CH_VALID bit used in the channel index should be masked out before using it to access the channel array. Signed-off-by: Ramax Lo <ramaxlo@gmail.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/plat-s3c24xx/dma.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index f65192d5b1d..f0ea7943ac5 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -1403,11 +1403,13 @@ static struct s3c2410_dma_chan *s3c2410_dma_map_channel(int channel)
ord = &dma_order->channels[channel];
for (ch = 0; ch < dma_channels; ch++) {
+ int tmp;
if (!is_channel_valid(ord->list[ch]))
continue;
- if (s3c2410_chans[ord->list[ch]].in_use == 0) {
- ch = ord->list[ch] & ~DMA_CH_VALID;
+ tmp = ord->list[ch] & ~DMA_CH_VALID;
+ if (s3c2410_chans[tmp].in_use == 0) {
+ ch = tmp;
goto found;
}
}