Commit 79d3bafa authored by Ming Qian's avatar Ming Qian Committed by Hans Verkuil

media: amphion: fix REVERSE_INULL issues reported by coverity

null-checking of a pointor is suggested before dereferencing it

Fixes: 9f599f35 ("media: amphion: add vpu core driver")
Reviewed-by: default avatarNicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: default avatarMing Qian <ming.qian@nxp.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
parent b237b058
......@@ -268,7 +268,7 @@ static int venc_g_parm(struct file *file, void *fh, struct v4l2_streamparm *parm
{
struct vpu_inst *inst = to_inst(file);
struct venc_t *venc = inst->priv;
struct v4l2_fract *timeperframe = &parm->parm.capture.timeperframe;
struct v4l2_fract *timeperframe;
if (!parm)
return -EINVAL;
......@@ -279,6 +279,7 @@ static int venc_g_parm(struct file *file, void *fh, struct v4l2_streamparm *parm
if (!vpu_helper_check_type(inst, parm->type))
return -EINVAL;
timeperframe = &parm->parm.capture.timeperframe;
parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME;
parm->parm.capture.readbuffers = 0;
timeperframe->numerator = venc->params.frame_rate.numerator;
......@@ -291,7 +292,7 @@ static int venc_s_parm(struct file *file, void *fh, struct v4l2_streamparm *parm
{
struct vpu_inst *inst = to_inst(file);
struct venc_t *venc = inst->priv;
struct v4l2_fract *timeperframe = &parm->parm.capture.timeperframe;
struct v4l2_fract *timeperframe;
unsigned long n, d;
if (!parm)
......@@ -303,6 +304,7 @@ static int venc_s_parm(struct file *file, void *fh, struct v4l2_streamparm *parm
if (!vpu_helper_check_type(inst, parm->type))
return -EINVAL;
timeperframe = &parm->parm.capture.timeperframe;
if (!timeperframe->numerator)
timeperframe->numerator = venc->params.frame_rate.numerator;
if (!timeperframe->denominator)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment