[hverkuil-media-tree:for-v5.19g 20/20] drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c:684:76: warning: cast from pointer to integer of different size

From: kernel test robot
Date: Fri Apr 29 2022 - 21:46:52 EST


tree: git://linuxtv.org/hverkuil/media_tree.git for-v5.19g
head: f82120aec4e7ee9f06251d36931ab36bd9ef3c42
commit: f82120aec4e7ee9f06251d36931ab36bd9ef3c42 [20/20] media: mediatek: vcodec: add h264 decoder driver for mt8186
config: mips-allmodconfig (https://download.01.org/0day-ci/archive/20220430/202204300913.PwSevnFI-lkp@xxxxxxxxx/config)
compiler: mips-linux-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git remote add hverkuil-media-tree git://linuxtv.org/hverkuil/media_tree.git
git fetch --no-tags hverkuil-media-tree for-v5.19g
git checkout f82120aec4e7ee9f06251d36931ab36bd9ef3c42
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/media/platform/mediatek/vcodec/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

In file included from include/linux/printk.h:555,
from include/linux/kernel.h:29,
from include/linux/cpumask.h:10,
from include/linux/smp.h:13,
from arch/mips/include/asm/cpu-type.h:12,
from arch/mips/include/asm/timex.h:19,
from include/linux/timex.h:65,
from include/linux/time32.h:13,
from include/linux/time.h:60,
from include/linux/stat.h:19,
from include/linux/module.h:13,
from drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c:7:
drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c: In function 'vdec_h264_slice_single_decode':
>> drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c:684:76: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
684 | inst->ctx->decoded_frame_cnt, y_fb_dma, c_fb_dma, (u64)fb);
| ^
include/linux/dynamic_debug.h:134:29: note: in definition of macro '__dynamic_func_call'
134 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:162:9: note: in expansion of macro '_dynamic_func_call'
162 | _dynamic_func_call(fmt, __dynamic_pr_debug, \
| ^~~~~~~~~~~~~~~~~~
include/linux/printk.h:570:9: note: in expansion of macro 'dynamic_pr_debug'
570 | dynamic_pr_debug(fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~
drivers/media/platform/mediatek/vcodec/vdec/../mtk_vcodec_util.h:45:9: note: in expansion of macro 'pr_debug'
45 | pr_debug("[MTK_VCODEC][%d]: " fmt "\n", \
| ^~~~~~~~
drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c:683:9: note: in expansion of macro 'mtk_vcodec_debug'
683 | mtk_vcodec_debug(inst, "+ [%d] FB y_dma=%llx c_dma=%llx va=0x%llx",
| ^~~~~~~~~~~~~~~~


vim +684 drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c

659
660 static int vdec_h264_slice_single_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
661 struct vdec_fb *unused, bool *res_chg)
662 {
663 struct vdec_h264_slice_inst *inst = h_vdec;
664 struct vdec_vpu_inst *vpu = &inst->vpu;
665 struct mtk_video_dec_buf *src_buf_info, *dst_buf_info;
666 struct vdec_fb *fb;
667 unsigned char *buf;
668 unsigned int nal_start_idx, data[2], i;
669 u64 y_fb_dma, c_fb_dma;
670 struct mtk_vcodec_mem *mem;
671 int err;
672
673 /* bs NULL means flush decoder */
674 if (!bs)
675 return vpu_dec_reset(vpu);
676
677 fb = inst->ctx->dev->vdec_pdata->get_cap_buffer(inst->ctx);
678 src_buf_info = container_of(bs, struct mtk_video_dec_buf, bs_buffer);
679 dst_buf_info = container_of(fb, struct mtk_video_dec_buf, frame_buffer);
680
681 y_fb_dma = fb ? (u64)fb->base_y.dma_addr : 0;
682 c_fb_dma = fb ? (u64)fb->base_c.dma_addr : 0;
683 mtk_vcodec_debug(inst, "+ [%d] FB y_dma=%llx c_dma=%llx va=0x%llx",
> 684 inst->ctx->decoded_frame_cnt, y_fb_dma, c_fb_dma, (u64)fb);
685
686 inst->vsi_ctx.dec.bs_buf_addr = (u64)bs->dma_addr;
687 inst->vsi_ctx.dec.bs_buf_size = bs->size;
688 inst->vsi_ctx.dec.y_fb_dma = y_fb_dma;
689 inst->vsi_ctx.dec.c_fb_dma = c_fb_dma;
690 inst->vsi_ctx.dec.vdec_fb_va = (u64)(uintptr_t)fb;
691
692 v4l2_m2m_buf_copy_metadata(&src_buf_info->m2m_buf.vb,
693 &dst_buf_info->m2m_buf.vb, true);
694 err = get_vdec_sig_decode_parameters(inst);
695 if (err)
696 goto err_free_fb_out;
697
698 buf = (unsigned char *)bs->va;
699 nal_start_idx = mtk_vdec_h264_find_start_code(buf, bs->size);
700 if (nal_start_idx < 0) {
701 err = -EINVAL;
702 goto err_free_fb_out;
703 }
704 inst->vsi_ctx.dec.nal_info = buf[nal_start_idx];
705
706 *res_chg = inst->resolution_changed;
707 if (inst->resolution_changed) {
708 mtk_vcodec_debug(inst, "- resolution changed -");
709 if (inst->realloc_mv_buf) {
710 err = vdec_h264_slice_alloc_mv_buf(inst, &inst->ctx->picinfo);
711 inst->realloc_mv_buf = false;
712 if (err)
713 goto err_free_fb_out;
714 }
715 inst->resolution_changed = false;
716
717 for (i = 0; i < H264_MAX_MV_NUM; i++) {
718 mem = &inst->mv_buf[i];
719 inst->vsi_ctx.mv_buf_dma[i] = mem->dma_addr;
720 }
721 }
722
723 memcpy_toio(inst->vpu.vsi, &inst->vsi_ctx, sizeof(inst->vsi_ctx));
724 err = vpu_dec_start(vpu, data, 2);
725 if (err)
726 goto err_free_fb_out;
727
728 /* wait decoder done interrupt */
729 err = mtk_vcodec_wait_for_done_ctx(inst->ctx, MTK_INST_IRQ_RECEIVED,
730 WAIT_INTR_TIMEOUT_MS, MTK_VDEC_CORE);
731 if (err)
732 mtk_vcodec_err(inst, "decode timeout: pic_%d",
733 inst->ctx->decoded_frame_cnt);
734
735 inst->vsi->dec.timeout = !!err;
736 err = vpu_dec_end(vpu);
737 if (err)
738 goto err_free_fb_out;
739
740 memcpy_fromio(&inst->vsi_ctx, inst->vpu.vsi, sizeof(inst->vsi_ctx));
741 mtk_vcodec_debug(inst, "pic[%d] crc: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x",
742 inst->ctx->decoded_frame_cnt,
743 inst->vsi_ctx.dec.crc[0], inst->vsi_ctx.dec.crc[1],
744 inst->vsi_ctx.dec.crc[2], inst->vsi_ctx.dec.crc[3],
745 inst->vsi_ctx.dec.crc[4], inst->vsi_ctx.dec.crc[5],
746 inst->vsi_ctx.dec.crc[6], inst->vsi_ctx.dec.crc[7]);
747
748 inst->ctx->decoded_frame_cnt++;
749 return 0;
750
751 err_free_fb_out:
752 mtk_vcodec_err(inst, "dec frame number: %d err: %d",
753 inst->ctx->decoded_frame_cnt, err);
754 return err;
755 }
756

--
0-DAY CI Kernel Test Service
https://01.org/lkp