[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210804142729.7231-5-dafna.hirschfeld@collabora.com>
Date: Wed, 4 Aug 2021 16:27:28 +0200
From: Dafna Hirschfeld <dafna.hirschfeld@...labora.com>
To: linux-media@...r.kernel.org, linux-mediatek@...ts.infradead.org,
linux-kernel@...r.kernel.org
Cc: dafna.hirschfeld@...labora.com, hverkuil@...all.nl,
kernel@...labora.com, dafna3@...il.com, mchehab@...nel.org,
tfiga@...omium.org, tiffany.lin@...iatek.com,
andrew-ct.chen@...iatek.com, matthias.bgg@...il.com,
hsinyi@...omium.org, maoguang.meng@...iatek.com,
irui.wang@...iatek.com, acourbot@...omium.org,
Yunfei.Dong@...iatek.com, yong.wu@...iatek.com, eizan@...omium.org
Subject: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handling
1. Fail if the function mtk_vcodec_fw_map_dm_addr
returns ERR pointer.
2. Fail if the state from the vpu msg is either
VEN_IPI_MSG_ENC_STATE_ERROR or VEN_IPI_MSG_ENC_STATE_PART
Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@...labora.com>
---
drivers/media/platform/mtk-vcodec/venc_vpu_if.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/media/platform/mtk-vcodec/venc_vpu_if.c b/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
index 32dc844d16f9..234705ba7cd6 100644
--- a/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
+++ b/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
@@ -17,6 +17,8 @@ static int handle_enc_init_msg(struct venc_vpu_inst *vpu, const void *data)
vpu->vsi = mtk_vcodec_fw_map_dm_addr(vpu->ctx->dev->fw_handler,
msg->vpu_inst_addr);
+ if (IS_ERR(vpu->vsi))
+ return PTR_ERR(vpu->vsi);
/* Firmware version field value is unspecified on MT8173. */
if (vpu->ctx->dev->venc_pdata->chip == MTK_MT8173)
return 0;
@@ -42,6 +44,12 @@ static int handle_enc_encode_msg(struct venc_vpu_inst *vpu, const void *data)
vpu->state = msg->state;
vpu->bs_size = msg->bs_size;
vpu->is_key_frm = msg->is_key_frm;
+ if (vpu->state == VEN_IPI_MSG_ENC_STATE_ERROR ||
+ vpu->state == VEN_IPI_MSG_ENC_STATE_PART) {
+ mtk_vcodec_err(vpu, "bad ipi-enc-state: %s",
+ vpu->state == VEN_IPI_MSG_ENC_STATE_ERROR ? "ERR" : "PART");
+ return -EINVAL;
+ }
return 0;
}
--
2.17.1
Powered by blists - more mailing lists