]> git.baikalelectronics.ru Git - kernel.git/commitdiff
dmaengine: imx-sdma: initialize all script addresses
authorSascha Hauer <s.hauer@pengutronix.de>
Wed, 13 May 2020 06:04:05 +0000 (08:04 +0200)
committerVinod Koul <vkoul@kernel.org>
Fri, 15 May 2020 07:01:06 +0000 (12:31 +0530)
The script addresses array increases with each new version. The driver
initializes the array to -EINVAL initially, but only up to the size
of the v1 array. Initialize the additional addresses for the newer
versions as well. Without this uninitialized values of the newer arrays
are treated as valid.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Robin Gong <yibin.gong@nxp.com>
Link: https://lore.kernel.org/r/20200513060405.18685-1-s.hauer@pengutronix.de
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/imx-sdma.c

index 4d4477df4ede751a9b4277833d851dc48fe8641f..91774039ae5d6345c14faf7ffb4685f2f8429f33 100644 (file)
@@ -2063,7 +2063,7 @@ static int sdma_probe(struct platform_device *pdev)
 
        /* initially no scripts available */
        saddr_arr = (s32 *)sdma->script_addrs;
-       for (i = 0; i < SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1; i++)
+       for (i = 0; i < sizeof(*sdma->script_addrs) / sizeof(s32); i++)
                saddr_arr[i] = -EINVAL;
 
        dma_cap_set(DMA_SLAVE, sdma->dma_device.cap_mask);