drm/exynos: fimc: fix wrong buf_id access for dma channel
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 31 Aug 2015 03:07:55 +0000 (12:07 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 14 Dec 2016 04:50:49 +0000 (13:50 +0900)
For destination buffers, buf_id is valid only less than maximum
dest buffer count. So this patch fixes wrong buf_id access to
dma_channel.

Change-Id: I4c73ab90a2fc8e57ecb82f277d3d53c2e91b910a
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
drivers/gpu/drm/exynos/exynos_drm_fimc.c

index 8a88c68..f63ea1a 100644 (file)
@@ -794,10 +794,7 @@ static int fimc_src_set_addr(struct device *dev,
        DRM_DEBUG_KMS("prop_id[%d]buf_id[%d]buf_type[%d]\n",
                property->prop_id, buf_id, buf_type);
 
-       if (buf_id > FIMC_MAX_SRC) {
-               dev_info(ippdrv->dev, "invalid buf_id %d.\n", buf_id);
-               return -ENOMEM;
-       }
+       buf_id %= FIMC_MAX_SRC;
 
        /* address register set */
        switch (buf_type) {
@@ -1263,10 +1260,7 @@ static int fimc_dst_set_addr(struct device *dev,
        DRM_DEBUG_KMS("prop_id[%d]buf_id[%d]buf_type[%d]\n",
                property->prop_id, buf_id, buf_type);
 
-       if (buf_id > FIMC_MAX_DST) {
-               dev_info(ippdrv->dev, "invalid buf_id %d.\n", buf_id);
-               return -ENOMEM;
-       }
+       buf_id %= FIMC_MAX_DST;
 
        /* address register set */
        switch (buf_type) {