From 25c42567af53f8efd6c862d28bf1554b371645a0 Mon Sep 17 00:00:00 2001 From: Cristina Ciocan Date: Thu, 8 Jun 2017 16:47:38 +0300 Subject: MLK-15027: arm: pxp: Fix uninitialized use of variables This patch fixes build warning that 2 variables may be used uninitialized in the pxp_fetch_config() function in drivers/dma/pxp/pxp_dma_v3.c . The variables in_fmt and out_fmt are passed as parameters to pxp_fetch_shift_calc() only if shift_bypass is false. This flag cannot be false unless changed in a code block that also assigns in_fmt and out_fmt. Since the compiler cannot detect this flow, it shows a warning that in_fmt and out_fmt are not initialized. Fix this by changing the code flow such that in_fmt and out_fmt are sent as parameters in the same code block where they are assigned. Signed-off-by: Cristina Ciocan (cherry picked from commit e710b061ef292402045b30ccb56bcdcd343d43c5) --- drivers/dma/pxp/pxp_dma_v3.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'drivers') diff --git a/drivers/dma/pxp/pxp_dma_v3.c b/drivers/dma/pxp/pxp_dma_v3.c index 0c5c05c401d0..37d63f072219 100644 --- a/drivers/dma/pxp/pxp_dma_v3.c +++ b/drivers/dma/pxp/pxp_dma_v3.c @@ -2307,23 +2307,27 @@ static int pxp_fetch_config(struct pxp_pixmap *input, shift_bypass = (flags & FETCH_SHIFT) ? 0 : 1; expand_en = (flags & FETCH_EXPAND) ? 1 : 0; - if (!shift_bypass && expand_en) { - if (is_yuv(input->format)) { - in_fmt = PXP_PIX_FMT_YVU444; - out_fmt = PXP_PIX_FMT_YUV444; + if (!shift_bypass) { + if (expand_en) { + if (is_yuv(input->format)) { + in_fmt = PXP_PIX_FMT_YVU444; + out_fmt = PXP_PIX_FMT_YUV444; + } else { + in_fmt = PXP_PIX_FMT_ABGR32; + out_fmt = PXP_PIX_FMT_ARGB32; + } } else { - in_fmt = PXP_PIX_FMT_ABGR32; - out_fmt = PXP_PIX_FMT_ARGB32; + in_fmt = input->format; + out_fmt = is_yuv(input->format) ? + PXP_PIX_FMT_YUV444 : + PXP_PIX_FMT_ARGB32; } - } else if (!shift_bypass) { - in_fmt = input->format; - out_fmt = is_yuv(input->format) ? PXP_PIX_FMT_YUV444 : - PXP_PIX_FMT_ARGB32; + + shift_offset = pxp_fetch_shift_calc(in_fmt, out_fmt, + &shift_width); } } shift_ctrl = pxp_fetch_shift_ctrl_config(input, shift_bypass, expand_en); - if (!shift_bypass) - shift_offset = pxp_fetch_shift_calc(in_fmt, out_fmt, &shift_width); offset = input->crop.y * input->pitch + input->crop.x * (input->bpp >> 3); -- cgit v1.2.3