mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-10 07:10:27 +00:00
media: camss: vfe: simplify vfe_get_wm_sizes()
Static analysis reports this representative problem camss-vfe-4-1.c:333: The result of the left shift is undefined because the left operand is negative reg |= (height - 1) << 4; ~~~~~~~~~ ^ The is a false positive. height is set in vfe_get_wm_sizes() which has a switch statement without a default. Reviewing the switch, the cases contain redundant assignments. So simplify to assignments. Signed-off-by: Tom Rix <trix@redhat.com> Reviewed-by: Robert Foss <robert.foss@linaro.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
a9be393118
commit
749d896551
@ -290,22 +290,14 @@ static void vfe_wm_frame_based(struct vfe_device *vfe, u8 wm, u8 enable)
|
||||
static void vfe_get_wm_sizes(struct v4l2_pix_format_mplane *pix, u8 plane,
|
||||
u16 *width, u16 *height, u16 *bytesperline)
|
||||
{
|
||||
switch (pix->pixelformat) {
|
||||
case V4L2_PIX_FMT_NV12:
|
||||
case V4L2_PIX_FMT_NV21:
|
||||
*width = pix->width;
|
||||
*height = pix->height;
|
||||
*bytesperline = pix->plane_fmt[0].bytesperline;
|
||||
*width = pix->width;
|
||||
*height = pix->height;
|
||||
*bytesperline = pix->plane_fmt[0].bytesperline;
|
||||
|
||||
if (pix->pixelformat == V4L2_PIX_FMT_NV12 ||
|
||||
pix->pixelformat == V4L2_PIX_FMT_NV21)
|
||||
if (plane == 1)
|
||||
*height /= 2;
|
||||
break;
|
||||
case V4L2_PIX_FMT_NV16:
|
||||
case V4L2_PIX_FMT_NV61:
|
||||
*width = pix->width;
|
||||
*height = pix->height;
|
||||
*bytesperline = pix->plane_fmt[0].bytesperline;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void vfe_wm_line_based(struct vfe_device *vfe, u32 wm,
|
||||
|
@ -370,30 +370,26 @@ static int vfe_word_per_line_by_bytes(u32 bytes_per_line)
|
||||
static void vfe_get_wm_sizes(struct v4l2_pix_format_mplane *pix, u8 plane,
|
||||
u16 *width, u16 *height, u16 *bytesperline)
|
||||
{
|
||||
*width = pix->width;
|
||||
*height = pix->height;
|
||||
|
||||
switch (pix->pixelformat) {
|
||||
case V4L2_PIX_FMT_NV12:
|
||||
case V4L2_PIX_FMT_NV21:
|
||||
*width = pix->width;
|
||||
*height = pix->height;
|
||||
*bytesperline = pix->plane_fmt[0].bytesperline;
|
||||
if (plane == 1)
|
||||
*height /= 2;
|
||||
break;
|
||||
case V4L2_PIX_FMT_NV16:
|
||||
case V4L2_PIX_FMT_NV61:
|
||||
*width = pix->width;
|
||||
*height = pix->height;
|
||||
*bytesperline = pix->plane_fmt[0].bytesperline;
|
||||
break;
|
||||
case V4L2_PIX_FMT_YUYV:
|
||||
case V4L2_PIX_FMT_YVYU:
|
||||
case V4L2_PIX_FMT_VYUY:
|
||||
case V4L2_PIX_FMT_UYVY:
|
||||
*width = pix->width;
|
||||
*height = pix->height;
|
||||
*bytesperline = pix->plane_fmt[plane].bytesperline;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -343,27 +343,24 @@ static int vfe_word_per_line_by_bytes(u32 bytes_per_line)
|
||||
static void vfe_get_wm_sizes(struct v4l2_pix_format_mplane *pix, u8 plane,
|
||||
u16 *width, u16 *height, u16 *bytesperline)
|
||||
{
|
||||
*width = pix->width;
|
||||
*height = pix->height;
|
||||
|
||||
switch (pix->pixelformat) {
|
||||
case V4L2_PIX_FMT_NV12:
|
||||
case V4L2_PIX_FMT_NV21:
|
||||
*width = pix->width;
|
||||
*height = pix->height;
|
||||
*bytesperline = pix->plane_fmt[0].bytesperline;
|
||||
if (plane == 1)
|
||||
*height /= 2;
|
||||
break;
|
||||
case V4L2_PIX_FMT_NV16:
|
||||
case V4L2_PIX_FMT_NV61:
|
||||
*width = pix->width;
|
||||
*height = pix->height;
|
||||
*bytesperline = pix->plane_fmt[0].bytesperline;
|
||||
break;
|
||||
case V4L2_PIX_FMT_YUYV:
|
||||
case V4L2_PIX_FMT_YVYU:
|
||||
case V4L2_PIX_FMT_VYUY:
|
||||
case V4L2_PIX_FMT_UYVY:
|
||||
*width = pix->width;
|
||||
*height = pix->height;
|
||||
*bytesperline = pix->plane_fmt[plane].bytesperline;
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user