dma/imx-sdma: use num_events to validate event_id0
authorRichard Zhao <richard.zhao@linaro.org>
Fri, 13 Jan 2012 03:10:00 +0000 (11:10 +0800)
committerVinod Koul <vinod.koul@linux.intel.com>
Tue, 31 Jan 2012 03:33:16 +0000 (09:03 +0530)
event number is not always 32. use num_events for checking instead.

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
drivers/dma/imx-sdma.c

index 1e0e516b481f31710d74462afc3e271002cf5fa3..5eb96b53e6da7895fbe9752d356fca8946a8be00 100644 (file)
@@ -723,7 +723,7 @@ static int sdma_config_channel(struct sdma_channel *sdmac)
        sdmac->per_addr = 0;
 
        if (sdmac->event_id0) {
-               if (sdmac->event_id0 > 32)
+               if (sdmac->event_id0 >= sdmac->sdma->num_events)
                        return -EINVAL;
                sdma_event_enable(sdmac, sdmac->event_id0);
        }