mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
media: amphion: fix REVERSE_INULL issues reported by coverity
[ Upstream commit79d3bafaec] null-checking of a pointor is suggested before dereferencing it Fixes:9f599f351e("media: amphion: add vpu core driver") Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Ming Qian <ming.qian@nxp.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
3930d62f5d
commit
bddd678fd2
@@ -278,7 +278,7 @@ static int venc_g_parm(struct file *file, void *fh, struct v4l2_streamparm *parm
|
|||||||
{
|
{
|
||||||
struct vpu_inst *inst = to_inst(file);
|
struct vpu_inst *inst = to_inst(file);
|
||||||
struct venc_t *venc = inst->priv;
|
struct venc_t *venc = inst->priv;
|
||||||
struct v4l2_fract *timeperframe = &parm->parm.capture.timeperframe;
|
struct v4l2_fract *timeperframe;
|
||||||
|
|
||||||
if (!parm)
|
if (!parm)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -289,6 +289,7 @@ static int venc_g_parm(struct file *file, void *fh, struct v4l2_streamparm *parm
|
|||||||
if (!vpu_helper_check_type(inst, parm->type))
|
if (!vpu_helper_check_type(inst, parm->type))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
timeperframe = &parm->parm.capture.timeperframe;
|
||||||
parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME;
|
parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME;
|
||||||
parm->parm.capture.readbuffers = 0;
|
parm->parm.capture.readbuffers = 0;
|
||||||
timeperframe->numerator = venc->params.frame_rate.numerator;
|
timeperframe->numerator = venc->params.frame_rate.numerator;
|
||||||
@@ -301,7 +302,7 @@ static int venc_s_parm(struct file *file, void *fh, struct v4l2_streamparm *parm
|
|||||||
{
|
{
|
||||||
struct vpu_inst *inst = to_inst(file);
|
struct vpu_inst *inst = to_inst(file);
|
||||||
struct venc_t *venc = inst->priv;
|
struct venc_t *venc = inst->priv;
|
||||||
struct v4l2_fract *timeperframe = &parm->parm.capture.timeperframe;
|
struct v4l2_fract *timeperframe;
|
||||||
unsigned long n, d;
|
unsigned long n, d;
|
||||||
|
|
||||||
if (!parm)
|
if (!parm)
|
||||||
@@ -313,6 +314,7 @@ static int venc_s_parm(struct file *file, void *fh, struct v4l2_streamparm *parm
|
|||||||
if (!vpu_helper_check_type(inst, parm->type))
|
if (!vpu_helper_check_type(inst, parm->type))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
timeperframe = &parm->parm.capture.timeperframe;
|
||||||
if (!timeperframe->numerator)
|
if (!timeperframe->numerator)
|
||||||
timeperframe->numerator = venc->params.frame_rate.numerator;
|
timeperframe->numerator = venc->params.frame_rate.numerator;
|
||||||
if (!timeperframe->denominator)
|
if (!timeperframe->denominator)
|
||||||
|
|||||||
Reference in New Issue
Block a user