From: Liu Ying Date: Wed, 23 Oct 2019 09:41:06 +0000 (+0800) Subject: MLK-22399 mxc IPUv3: cpmem: Get 0 u/v_offset in __ipu_ch_offset_calc() for some pfmts X-Git-Tag: rel_imx_4.19.35_1.1.0~18 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=0c72abc3c3bf63922902805b13b4ab5c47a7cb4e;p=linux.git MLK-22399 mxc IPUv3: cpmem: Get 0 u/v_offset in __ipu_ch_offset_calc() for some pfmts There are no u/v planars in the pixel formats IPU_PIX_FMT_BGRA4444/IPU_PIX_FMT_BGRA5551/IPU_PIX_FMT_AYUV, so we should explicitly get zero u/v_offset from __ipu_ch_offset_calc() for those pixel formats. Without this patch, '-EINVAL' will be returned from __ipu_ch_offset_calc() as the function return value and input parameter u/v_offset will not be touched, which is not a good behavior, because the caller is likely to ignore the function return value and take the u/v_offset as valid value. The MXC IPUv3 fb driver is a such kind of caller, which may get the u/v_offset for those pixel formats without checking the function return value, and hence wrongly pass the u/v_offset to PRE driver(finally causes malfunction). Signed-off-by: Liu Ying (cherry picked from commit c1ff0b03944e5196497be4f606979f5cb0c1b413) --- diff --git a/drivers/mxc/ipu3/ipu_param_mem.h b/drivers/mxc/ipu3/ipu_param_mem.h index a22839a98ac8..020f75ece50e 100644 --- a/drivers/mxc/ipu3/ipu_param_mem.h +++ b/drivers/mxc/ipu3/ipu_param_mem.h @@ -1,5 +1,6 @@ /* * Copyright 2005-2015 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright 2019 NXP */ /* @@ -744,9 +745,12 @@ static inline int __ipu_ch_offset_calc(uint32_t pixel_fmt, case IPU_PIX_FMT_GENERIC_16: case IPU_PIX_FMT_GENERIC_32: case IPU_PIX_FMT_RGB565: + case IPU_PIX_FMT_BGRA4444: + case IPU_PIX_FMT_BGRA5551: case IPU_PIX_FMT_BGR24: case IPU_PIX_FMT_RGB24: case IPU_PIX_FMT_YUV444: + case IPU_PIX_FMT_AYUV: case IPU_PIX_FMT_BGRA32: case IPU_PIX_FMT_BGR32: case IPU_PIX_FMT_RGBA32: