diff options
author | Cristina Ciocan <cristina-mihaela.ciocan@nxp.com> | 2017-06-08 16:47:38 +0300 |
---|---|---|
committer | Cristina Ciocan <cristina-mihaela.ciocan@nxp.com> | 2017-07-05 14:25:46 +0300 |
commit | 25c42567af53f8efd6c862d28bf1554b371645a0 (patch) | |
tree | db330acb81b3f5a9080abd4dc801d10c7ea421a9 /drivers | |
parent | 3026bea0bfb820858793cfec5fddbac089b598fa (diff) |
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 <cristina-mihaela.ciocan@nxp.com>
(cherry picked from commit e710b061ef292402045b30ccb56bcdcd343d43c5)
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/dma/pxp/pxp_dma_v3.c | 28 |
1 files changed, 16 insertions, 12 deletions
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); |