Commit 9eeb0ed0 authored by Minghsiu Tsai's avatar Minghsiu Tsai Committed by Mauro Carvalho Chehab

[media] mtk-vcodec: fix build warnings without DEBUG

After removing DEBUG from mtk_vcodec_util.h, some build warnings are
generated as the following:
.../drivers/media/platform/mtk-vcodec/vdec_vpu_if.c: In function 'vcodec_vpu_send_msg':
.../drivers/media/platform/mtk-vcodec/vdec_vpu_if.c:73:11: warning: unused variable 'msg_id' [-Wunused-variable]
  uint32_t msg_id = *(uint32_t *)msg;
           ^
.../drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c: In function 'vb2ops_vdec_buf_queue':
.../drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c:1129:7: warning: unused variable 'log_level' [-Wunused-variable]
   int log_level = ret ? 0 : 1;
       ^
.../drivers/media/platform/mtk-vcodec/venc_vpu_if.c: In function 'vpu_enc_send_msg':
.../drivers/media/platform/mtk-vcodec/venc_vpu_if.c:82:12: warning: unused variable 'msg_id' [-Wunused-variable]
   uint32_t msg_id = *(uint32_t *)msg;
            ^

It is because mtk_vcodec_debug() and mtk_vcodec_err() are defined as empty
macros. Without DEBUG definition, the variable for debugging is not used
anymore. Fixing build warnings by moving the assignment of the
variable to the argument of mtk_vcodec_debug() and mtk_vcodec_err().
Within the patch, build pass with/without DEBUG definition, and functions
still work fine.
Signed-off-by: default avatarMinghsiu Tsai <minghsiu.tsai@mediatek.com>
Reviewed-by: default avatarDaniel Kurtz <djkurtz@chromium.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 0d1270df
...@@ -1168,15 +1168,14 @@ static void vb2ops_vdec_buf_queue(struct vb2_buffer *vb) ...@@ -1168,15 +1168,14 @@ static void vb2ops_vdec_buf_queue(struct vb2_buffer *vb)
* if there is no SPS header or picture info * if there is no SPS header or picture info
* in bs * in bs
*/ */
int log_level = ret ? 0 : 1;
src_buf = v4l2_m2m_src_buf_remove(ctx->m2m_ctx); src_buf = v4l2_m2m_src_buf_remove(ctx->m2m_ctx);
v4l2_m2m_buf_done(to_vb2_v4l2_buffer(src_buf), v4l2_m2m_buf_done(to_vb2_v4l2_buffer(src_buf),
VB2_BUF_STATE_DONE); VB2_BUF_STATE_DONE);
mtk_v4l2_debug(log_level, mtk_v4l2_debug(ret ? 0 : 1,
"[%d] vdec_if_decode() src_buf=%d, size=%zu, fail=%d, res_chg=%d", "[%d] vdec_if_decode() src_buf=%d, size=%zu, fail=%d, res_chg=%d",
ctx->id, src_buf->index, ctx->id, src_buf->index,
src_mem.size, ret, res_chg); src_mem.size, ret, res_chg);
return; return;
} }
......
...@@ -70,9 +70,8 @@ void vpu_dec_ipi_handler(void *data, unsigned int len, void *priv) ...@@ -70,9 +70,8 @@ void vpu_dec_ipi_handler(void *data, unsigned int len, void *priv)
static int vcodec_vpu_send_msg(struct vdec_vpu_inst *vpu, void *msg, int len) static int vcodec_vpu_send_msg(struct vdec_vpu_inst *vpu, void *msg, int len)
{ {
int err; int err;
uint32_t msg_id = *(uint32_t *)msg;
mtk_vcodec_debug(vpu, "id=%X", msg_id); mtk_vcodec_debug(vpu, "id=%X", *(uint32_t *)msg);
vpu->failure = 0; vpu->failure = 0;
vpu->signaled = 0; vpu->signaled = 0;
...@@ -80,7 +79,7 @@ static int vcodec_vpu_send_msg(struct vdec_vpu_inst *vpu, void *msg, int len) ...@@ -80,7 +79,7 @@ static int vcodec_vpu_send_msg(struct vdec_vpu_inst *vpu, void *msg, int len)
err = vpu_ipi_send(vpu->dev, vpu->id, msg, len); err = vpu_ipi_send(vpu->dev, vpu->id, msg, len);
if (err) { if (err) {
mtk_vcodec_err(vpu, "send fail vpu_id=%d msg_id=%X status=%d", mtk_vcodec_err(vpu, "send fail vpu_id=%d msg_id=%X status=%d",
vpu->id, msg_id, err); vpu->id, *(uint32_t *)msg, err);
return err; return err;
} }
......
...@@ -79,10 +79,8 @@ static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg, ...@@ -79,10 +79,8 @@ static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg,
status = vpu_ipi_send(vpu->dev, vpu->id, msg, len); status = vpu_ipi_send(vpu->dev, vpu->id, msg, len);
if (status) { if (status) {
uint32_t msg_id = *(uint32_t *)msg;
mtk_vcodec_err(vpu, "vpu_ipi_send msg_id %x len %d fail %d", mtk_vcodec_err(vpu, "vpu_ipi_send msg_id %x len %d fail %d",
msg_id, len, status); *(uint32_t *)msg, len, status);
return -EINVAL; return -EINVAL;
} }
if (vpu->failure) if (vpu->failure)
......
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