Skip to contentSkip to conversation

drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c:723 vdec_h264_slice_decode() warn: missing error code 'err'

PATCH New Dan Carpenter 1 participant 1 message Apr 9, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 12/43 drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c:723 vdec_h264_slice_decode() warn: missing error code 'err'

tree:   https://chromium.googlesource.com/chromiumos/third_party/kernel chromeos-5.4
head:   885f54059e5be0bbd38287623c841b1e4db1aa57
commit: 5fa56a01339db0586f27519d81aa226f1bb49f03 [12/43] FROMLIST: media: mtk-vcodec: vdec: support stateless H.264 decoding
config: xtensa-randconfig-m031-20210401 (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate

smatch warnings:
drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c:723 vdec_h264_slice_decode() warn: missing error code 'err'

vim +/err +723 drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c

5fa56a01339db0 Yunfei Dong 2021-02-26  695  static int vdec_h264_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
5fa56a01339db0 Yunfei Dong 2021-02-26  696  				  struct vdec_fb *fb, bool *res_chg)
5fa56a01339db0 Yunfei Dong 2021-02-26  697  {
5fa56a01339db0 Yunfei Dong 2021-02-26  698  	struct vdec_h264_slice_inst *inst =
5fa56a01339db0 Yunfei Dong 2021-02-26  699  		(struct vdec_h264_slice_inst *)h_vdec;
5fa56a01339db0 Yunfei Dong 2021-02-26  700  	struct vdec_vpu_inst *vpu = &inst->vpu;
5fa56a01339db0 Yunfei Dong 2021-02-26  701  	struct mtk_video_dec_buf *src_buf_info;
5fa56a01339db0 Yunfei Dong 2021-02-26  702  	int nal_start_idx = 0, err = 0;
5fa56a01339db0 Yunfei Dong 2021-02-26  703  	uint32_t nal_type, data[2];
5fa56a01339db0 Yunfei Dong 2021-02-26  704  	unsigned char *buf;
5fa56a01339db0 Yunfei Dong 2021-02-26  705  	uint64_t y_fb_dma;
5fa56a01339db0 Yunfei Dong 2021-02-26  706  	uint64_t c_fb_dma;
5fa56a01339db0 Yunfei Dong 2021-02-26  707  
5fa56a01339db0 Yunfei Dong 2021-02-26  708  	mtk_vcodec_debug(inst, "+ [%d] FB y_dma=%llx c_dma=%llx va=%p",
5fa56a01339db0 Yunfei Dong 2021-02-26  709  			 ++inst->num_nalu, y_fb_dma, c_fb_dma, fb);
5fa56a01339db0 Yunfei Dong 2021-02-26  710  
5fa56a01339db0 Yunfei Dong 2021-02-26  711  	/* bs NULL means flush decoder */
5fa56a01339db0 Yunfei Dong 2021-02-26  712  	if (bs == NULL)
5fa56a01339db0 Yunfei Dong 2021-02-26  713  		return vpu_dec_reset(vpu);
5fa56a01339db0 Yunfei Dong 2021-02-26  714  
5fa56a01339db0 Yunfei Dong 2021-02-26  715  	src_buf_info = container_of(bs, struct mtk_video_dec_buf, bs_buffer);
5fa56a01339db0 Yunfei Dong 2021-02-26  716  
5fa56a01339db0 Yunfei Dong 2021-02-26  717  	y_fb_dma = fb ? (u64)fb->base_y.dma_addr : 0;
5fa56a01339db0 Yunfei Dong 2021-02-26  718  	c_fb_dma = fb ? (u64)fb->base_c.dma_addr : 0;
5fa56a01339db0 Yunfei Dong 2021-02-26  719  
5fa56a01339db0 Yunfei Dong 2021-02-26  720  	buf = (unsigned char *)bs->va;
5fa56a01339db0 Yunfei Dong 2021-02-26  721  	nal_start_idx = find_start_code(buf, bs->size);
5fa56a01339db0 Yunfei Dong 2021-02-26  722  	if (nal_start_idx < 0)

5fa56a01339db0 Yunfei Dong 2021-02-26 @723 goto err_free_fb_out;

"err = nal_start_idx;"

5fa56a01339db0 Yunfei Dong 2021-02-26  724  
5fa56a01339db0 Yunfei Dong 2021-02-26  725  	data[0] = bs->size;
5fa56a01339db0 Yunfei Dong 2021-02-26  726  	data[1] = buf[nal_start_idx];
5fa56a01339db0 Yunfei Dong 2021-02-26  727  	nal_type = NAL_TYPE(buf[nal_start_idx]);
5fa56a01339db0 Yunfei Dong 2021-02-26  728  	mtk_vcodec_debug(inst, "\n + NALU[%d] type %d +\n", inst->num_nalu,
5fa56a01339db0 Yunfei Dong 2021-02-26  729  			 nal_type);
5fa56a01339db0 Yunfei Dong 2021-02-26  730  
5fa56a01339db0 Yunfei Dong 2021-02-26  731  	inst->vsi_ctx.dec.bs_dma = (uint64_t)bs->dma_addr;
5fa56a01339db0 Yunfei Dong 2021-02-26  732  	inst->vsi_ctx.dec.y_fb_dma = y_fb_dma;
5fa56a01339db0 Yunfei Dong 2021-02-26  733  	inst->vsi_ctx.dec.c_fb_dma = c_fb_dma;
5fa56a01339db0 Yunfei Dong 2021-02-26  734  	inst->vsi_ctx.dec.vdec_fb_va = (u64)(uintptr_t)fb;
5fa56a01339db0 Yunfei Dong 2021-02-26  735  
5fa56a01339db0 Yunfei Dong 2021-02-26  736  	get_vdec_decode_parameters(inst);
5fa56a01339db0 Yunfei Dong 2021-02-26  737  	*res_chg = inst->vsi_ctx.dec.resolution_changed;
5fa56a01339db0 Yunfei Dong 2021-02-26  738  	if (*res_chg) {
5fa56a01339db0 Yunfei Dong 2021-02-26  739  		mtk_vcodec_debug(inst, "- resolution changed -");
5fa56a01339db0 Yunfei Dong 2021-02-26  740  		if (inst->vsi_ctx.dec.realloc_mv_buf) {
5fa56a01339db0 Yunfei Dong 2021-02-26  741  			err = alloc_mv_buf(inst, &(inst->ctx->picinfo));
5fa56a01339db0 Yunfei Dong 2021-02-26  742  			inst->vsi_ctx.dec.realloc_mv_buf = false;
5fa56a01339db0 Yunfei Dong 2021-02-26  743  			if (err)
5fa56a01339db0 Yunfei Dong 2021-02-26  744  				goto err_free_fb_out;
5fa56a01339db0 Yunfei Dong 2021-02-26  745  		}
5fa56a01339db0 Yunfei Dong 2021-02-26  746  		*res_chg = false;
5fa56a01339db0 Yunfei Dong 2021-02-26  747  	}
5fa56a01339db0 Yunfei Dong 2021-02-26  748  
5fa56a01339db0 Yunfei Dong 2021-02-26  749  	memcpy(inst->vpu.vsi, &inst->vsi_ctx, sizeof(inst->vsi_ctx));
5fa56a01339db0 Yunfei Dong 2021-02-26  750  	err = vpu_dec_start(vpu, data, 2);
5fa56a01339db0 Yunfei Dong 2021-02-26  751  	if (err)
5fa56a01339db0 Yunfei Dong 2021-02-26  752  		goto err_free_fb_out;
5fa56a01339db0 Yunfei Dong 2021-02-26  753  
5fa56a01339db0 Yunfei Dong 2021-02-26  754  	if (nal_type == NAL_NON_IDR_SLICE || nal_type == NAL_IDR_SLICE) {
5fa56a01339db0 Yunfei Dong 2021-02-26  755  		/* wait decoder done interrupt */
5fa56a01339db0 Yunfei Dong 2021-02-26  756  		err = mtk_vcodec_wait_for_done_ctx(inst->ctx,
5fa56a01339db0 Yunfei Dong 2021-02-26  757  						   MTK_INST_IRQ_RECEIVED,
5fa56a01339db0 Yunfei Dong 2021-02-26  758  						   WAIT_INTR_TIMEOUT_MS);
5fa56a01339db0 Yunfei Dong 2021-02-26  759  		if (err)
5fa56a01339db0 Yunfei Dong 2021-02-26  760  			goto err_free_fb_out;
5fa56a01339db0 Yunfei Dong 2021-02-26  761  
5fa56a01339db0 Yunfei Dong 2021-02-26  762  		vpu_dec_end(vpu);
5fa56a01339db0 Yunfei Dong 2021-02-26  763  	}
5fa56a01339db0 Yunfei Dong 2021-02-26  764  
5fa56a01339db0 Yunfei Dong 2021-02-26  765  	memcpy(&inst->vsi_ctx, inst->vpu.vsi, sizeof(inst->vsi_ctx));
5fa56a01339db0 Yunfei Dong 2021-02-26  766  	mtk_vcodec_debug(inst, "\n - NALU[%d] type=%d -\n", inst->num_nalu,
5fa56a01339db0 Yunfei Dong 2021-02-26  767  			 nal_type);
5fa56a01339db0 Yunfei Dong 2021-02-26  768  	return 0;
5fa56a01339db0 Yunfei Dong 2021-02-26  769  
5fa56a01339db0 Yunfei Dong 2021-02-26  770  err_free_fb_out:
5fa56a01339db0 Yunfei Dong 2021-02-26  771  	mtk_vcodec_err(inst, "\n - NALU[%d] err=%d -\n", inst->num_nalu, err);
5fa56a01339db0 Yunfei Dong 2021-02-26  772  	return err;
5fa56a01339db0 Yunfei Dong 2021-02-26  773  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org