mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
media: amphion: fix CHECKED_RETURN issues reported by coverity
[ Upstream commitb237b058ad] calling "vpu_cmd_send/vpu_get_buffer_state/vpu_session_alloc_fs" without checking return value 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
9ada33ee83
commit
3930d62f5d
@@ -957,6 +957,7 @@ static int vdec_response_frame_abnormal(struct vpu_inst *inst)
|
|||||||
{
|
{
|
||||||
struct vdec_t *vdec = inst->priv;
|
struct vdec_t *vdec = inst->priv;
|
||||||
struct vpu_fs_info info;
|
struct vpu_fs_info info;
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (!vdec->req_frame_count)
|
if (!vdec->req_frame_count)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -964,7 +965,9 @@ static int vdec_response_frame_abnormal(struct vpu_inst *inst)
|
|||||||
memset(&info, 0, sizeof(info));
|
memset(&info, 0, sizeof(info));
|
||||||
info.type = MEM_RES_FRAME;
|
info.type = MEM_RES_FRAME;
|
||||||
info.tag = vdec->seq_tag + 0xf0;
|
info.tag = vdec->seq_tag + 0xf0;
|
||||||
vpu_session_alloc_fs(inst, &info);
|
ret = vpu_session_alloc_fs(inst, &info);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
vdec->req_frame_count--;
|
vdec->req_frame_count--;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -306,7 +306,8 @@ static void vpu_core_keep_active(struct vpu_core *core)
|
|||||||
|
|
||||||
dev_dbg(core->dev, "try to wake up\n");
|
dev_dbg(core->dev, "try to wake up\n");
|
||||||
mutex_lock(&core->cmd_lock);
|
mutex_lock(&core->cmd_lock);
|
||||||
vpu_cmd_send(core, &pkt);
|
if (vpu_cmd_send(core, &pkt))
|
||||||
|
dev_err(core->dev, "fail to keep active\n");
|
||||||
mutex_unlock(&core->cmd_lock);
|
mutex_unlock(&core->cmd_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,13 @@ static char *vpu_stat_name[] = {
|
|||||||
[VPU_BUF_STATE_ERROR] = "error",
|
[VPU_BUF_STATE_ERROR] = "error",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline const char *to_vpu_stat_name(int state)
|
||||||
|
{
|
||||||
|
if (state <= VPU_BUF_STATE_ERROR)
|
||||||
|
return vpu_stat_name[state];
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
|
||||||
static int vpu_dbg_instance(struct seq_file *s, void *data)
|
static int vpu_dbg_instance(struct seq_file *s, void *data)
|
||||||
{
|
{
|
||||||
struct vpu_inst *inst = s->private;
|
struct vpu_inst *inst = s->private;
|
||||||
@@ -141,7 +148,7 @@ static int vpu_dbg_instance(struct seq_file *s, void *data)
|
|||||||
num = scnprintf(str, sizeof(str),
|
num = scnprintf(str, sizeof(str),
|
||||||
"output [%2d] state = %10s, %8s\n",
|
"output [%2d] state = %10s, %8s\n",
|
||||||
i, vb2_stat_name[vb->state],
|
i, vb2_stat_name[vb->state],
|
||||||
vpu_stat_name[vpu_get_buffer_state(vbuf)]);
|
to_vpu_stat_name(vpu_get_buffer_state(vbuf)));
|
||||||
if (seq_write(s, str, num))
|
if (seq_write(s, str, num))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -156,7 +163,7 @@ static int vpu_dbg_instance(struct seq_file *s, void *data)
|
|||||||
num = scnprintf(str, sizeof(str),
|
num = scnprintf(str, sizeof(str),
|
||||||
"capture[%2d] state = %10s, %8s\n",
|
"capture[%2d] state = %10s, %8s\n",
|
||||||
i, vb2_stat_name[vb->state],
|
i, vb2_stat_name[vb->state],
|
||||||
vpu_stat_name[vpu_get_buffer_state(vbuf)]);
|
to_vpu_stat_name(vpu_get_buffer_state(vbuf)));
|
||||||
if (seq_write(s, str, num))
|
if (seq_write(s, str, num))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user