Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: samsung: s5p-jpeg: Drop unneeded v4l2_m2m_get_vq() NULL check

The v4l2_m2m_get_vq() function never returns NULL.

In the set format handler, the check may have been intended to catch
invalid format types, but that's not needed as the V4L2 core picks the
appropriate VIDIOC_S_FMT ioctl handler based on the format type, so the
type can't be incorrect.

In the get format handler, the return value is not used for any purpose
other than the NULL check, which was therefore probably intended to
catch invalid format types. That's not needed for the same reason as in
the set format handler.

Drop the unneeded return value check and, as the function has no side
effect, the unneeded function call as well.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Laurent Pinchart and committed by
Hans Verkuil
f47955fc f1a31151

-7
-7
drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c
··· 1332 1332 1333 1333 static int s5p_jpeg_g_fmt(struct file *file, void *priv, struct v4l2_format *f) 1334 1334 { 1335 - struct vb2_queue *vq; 1336 1335 struct s5p_jpeg_q_data *q_data = NULL; 1337 1336 struct v4l2_pix_format *pix = &f->fmt.pix; 1338 1337 struct s5p_jpeg_ctx *ct = file_to_ctx(file); 1339 - 1340 - vq = v4l2_m2m_get_vq(ct->fh.m2m_ctx, f->type); 1341 - if (!vq) 1342 - return -EINVAL; 1343 1338 1344 1339 if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && 1345 1340 ct->mode == S5P_JPEG_DECODE && !ct->hdr_parsed) ··· 1588 1593 unsigned int f_type; 1589 1594 1590 1595 vq = v4l2_m2m_get_vq(ct->fh.m2m_ctx, f->type); 1591 - if (!vq) 1592 - return -EINVAL; 1593 1596 1594 1597 q_data = get_q_data(ct, f->type); 1595 1598 BUG_ON(q_data == NULL);