tree:   https://chromium.googlesource.com/chromiumos/third_party/kernel  
chromeos-5.4
head:   52d269f32500581166246e0e494b2b62d979dba6
commit: 0a438b290ea431bc87156be5819e9f85fa951240 [54/243] CHROMIUM: media: 
mtk-vcodec: Add h264 slice api driver for mt8192
compiler: hppa-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <l...@intel.com>

cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_lat_if.c:575:34: 
>> warning: Uninitialized variable: timeout [uninitvar]
    if (err == SLICE_HEADER_FULL || timeout || (err == TRANS_BUFFER_FULL &&
                                    ^

vim +575 drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_lat_if.c

0a438b290ea431 Yunfei Dong 2021-01-05  473  static int 
vdec_h264_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
0a438b290ea431 Yunfei Dong 2021-01-05  474      struct vdec_fb *fb, bool 
*res_chg)
0a438b290ea431 Yunfei Dong 2021-01-05  475  {
0a438b290ea431 Yunfei Dong 2021-01-05  476      struct vdec_h264_slice_inst 
*inst = h_vdec;
0a438b290ea431 Yunfei Dong 2021-01-05  477      struct vdec_vpu_inst *vpu = 
&inst->vpu;
0a438b290ea431 Yunfei Dong 2021-01-05  478      struct mtk_video_dec_buf 
*src_buf_info;
0a438b290ea431 Yunfei Dong 2021-01-05  479      int nal_start_idx, err, 
timeout, i;
                                                                        ^^^^^^^

0a438b290ea431 Yunfei Dong 2021-01-05  480      unsigned int nal_type, data[2];
0a438b290ea431 Yunfei Dong 2021-01-05  481      struct vdec_lat_buf *lat_buf;
0a438b290ea431 Yunfei Dong 2021-01-05  482      struct 
vdec_h264_slice_share_info *share_info;
0a438b290ea431 Yunfei Dong 2021-01-05  483      unsigned char *buf;
0a438b290ea431 Yunfei Dong 2021-01-05  484      struct mtk_vcodec_mem *mem;
0a438b290ea431 Yunfei Dong 2021-01-05  485  
0a438b290ea431 Yunfei Dong 2021-01-05  486      mtk_vcodec_debug(inst, "+ [%d] 
", ++inst->num_nalu);
0a438b290ea431 Yunfei Dong 2021-01-05  487  
0a438b290ea431 Yunfei Dong 2021-01-05  488      if 
(!inst->ctx->msg_queue.init_done) {
0a438b290ea431 Yunfei Dong 2021-01-05  489              if 
(vdec_msg_queue_init(inst->ctx, &inst->ctx->msg_queue,
0a438b290ea431 Yunfei Dong 2021-01-05  490                      
vdec_h264_slice_core_decode, sizeof(*share_info)))
0a438b290ea431 Yunfei Dong 2021-01-05  491              return -ENOMEM;
0a438b290ea431 Yunfei Dong 2021-01-05  492      }
0a438b290ea431 Yunfei Dong 2021-01-05  493  
0a438b290ea431 Yunfei Dong 2021-01-05  494      /* bs NULL means flush decoder 
*/
0a438b290ea431 Yunfei Dong 2021-01-05  495      if (!bs) {
0a438b290ea431 Yunfei Dong 2021-01-05  496              
vdec_msg_queue_wait_lat_buf_full(&inst->ctx->msg_queue);
0a438b290ea431 Yunfei Dong 2021-01-05  497              return 
vpu_dec_reset(vpu);
0a438b290ea431 Yunfei Dong 2021-01-05  498      }
0a438b290ea431 Yunfei Dong 2021-01-05  499  
0a438b290ea431 Yunfei Dong 2021-01-05  500      lat_buf = 
vdec_msg_queue_get_lat_buf(&inst->ctx->msg_queue);
0a438b290ea431 Yunfei Dong 2021-01-05  501      if (!lat_buf) {
0a438b290ea431 Yunfei Dong 2021-01-05  502              mtk_vcodec_err(inst, 
"failed to get lat buffer");
0a438b290ea431 Yunfei Dong 2021-01-05  503              return -EINVAL;
0a438b290ea431 Yunfei Dong 2021-01-05  504      }
0a438b290ea431 Yunfei Dong 2021-01-05  505      share_info = 
lat_buf->private_data;
0a438b290ea431 Yunfei Dong 2021-01-05  506      src_buf_info = container_of(bs, 
struct mtk_video_dec_buf, bs_buffer);
0a438b290ea431 Yunfei Dong 2021-01-05  507  
0a438b290ea431 Yunfei Dong 2021-01-05  508      buf = (unsigned char *)bs->va;
0a438b290ea431 Yunfei Dong 2021-01-05  509      nal_start_idx = 
mtk_vdec_h264_find_start_code(buf, bs->size);
0a438b290ea431 Yunfei Dong 2021-01-05  510      if (nal_start_idx < 0) {
0a438b290ea431 Yunfei Dong 2021-01-05  511              err = -EINVAL;
0a438b290ea431 Yunfei Dong 2021-01-05  512              goto err_free_fb_out;
0a438b290ea431 Yunfei Dong 2021-01-05  513      }
0a438b290ea431 Yunfei Dong 2021-01-05  514  
0a438b290ea431 Yunfei Dong 2021-01-05  515      inst->vsi->dec.nal_info = 
buf[nal_start_idx];
0a438b290ea431 Yunfei Dong 2021-01-05  516      nal_type = 
NAL_TYPE(buf[nal_start_idx]);
0a438b290ea431 Yunfei Dong 2021-01-05  517      mtk_vcodec_debug(inst, "\n + 
NALU[%d] type %d +\n", inst->num_nalu,
0a438b290ea431 Yunfei Dong 2021-01-05  518                       nal_type);
0a438b290ea431 Yunfei Dong 2021-01-05  519  
0a438b290ea431 Yunfei Dong 2021-01-05  520      inst->vsi->dec.bs_buf_addr = 
(uint64_t)bs->dma_addr;
0a438b290ea431 Yunfei Dong 2021-01-05  521      inst->vsi->dec.bs_buf_size = 
bs->size;
0a438b290ea431 Yunfei Dong 2021-01-05  522  
0a438b290ea431 Yunfei Dong 2021-01-05  523      
v4l2_m2m_buf_copy_metadata(&src_buf_info->m2m_buf.vb,
0a438b290ea431 Yunfei Dong 2021-01-05  524              &lat_buf->ts_info, 
true);
0a438b290ea431 Yunfei Dong 2021-01-05  525  
0a438b290ea431 Yunfei Dong 2021-01-05  526      
vdec_h264_slice_fill_decode_parameters(inst, share_info);
0a438b290ea431 Yunfei Dong 2021-01-05  527      *res_chg = 
inst->resolution_changed;
0a438b290ea431 Yunfei Dong 2021-01-05  528      if (inst->resolution_changed) {
0a438b290ea431 Yunfei Dong 2021-01-05  529              mtk_vcodec_debug(inst, 
"- resolution changed -");
0a438b290ea431 Yunfei Dong 2021-01-05  530              if 
(inst->realloc_mv_buf) {
0a438b290ea431 Yunfei Dong 2021-01-05  531                      err = 
vdec_h264_slice_alloc_mv_buf(inst, &inst->ctx->picinfo);
0a438b290ea431 Yunfei Dong 2021-01-05  532                      
inst->realloc_mv_buf = false;
0a438b290ea431 Yunfei Dong 2021-01-05  533                      if (err)
0a438b290ea431 Yunfei Dong 2021-01-05  534                              goto 
err_free_fb_out;
0a438b290ea431 Yunfei Dong 2021-01-05  535              }
0a438b290ea431 Yunfei Dong 2021-01-05  536              
inst->resolution_changed = false;
0a438b290ea431 Yunfei Dong 2021-01-05  537      }
0a438b290ea431 Yunfei Dong 2021-01-05  538      for (i = 0; i < 
H264_MAX_MV_NUM; i++) {
0a438b290ea431 Yunfei Dong 2021-01-05  539              mem = &inst->mv_buf[i];
0a438b290ea431 Yunfei Dong 2021-01-05  540              
inst->vsi->mv_buf_dma[i] = mem->dma_addr;
0a438b290ea431 Yunfei Dong 2021-01-05  541      }
0a438b290ea431 Yunfei Dong 2021-01-05  542      inst->vsi->wdma_start_addr = 
lat_buf->ctx->msg_queue.wdma_addr.dma_addr;
0a438b290ea431 Yunfei Dong 2021-01-05  543      inst->vsi->wdma_end_addr = 
lat_buf->ctx->msg_queue.wdma_addr.dma_addr +
0a438b290ea431 Yunfei Dong 2021-01-05  544              
lat_buf->ctx->msg_queue.wdma_addr.size;
0a438b290ea431 Yunfei Dong 2021-01-05  545      inst->vsi->wdma_err_addr = 
lat_buf->wdma_err_addr.dma_addr;
0a438b290ea431 Yunfei Dong 2021-01-05  546      inst->vsi->slice_bc_start_addr 
= lat_buf->slice_bc_addr.dma_addr;
0a438b290ea431 Yunfei Dong 2021-01-05  547      inst->vsi->slice_bc_end_addr = 
lat_buf->slice_bc_addr.dma_addr +
0a438b290ea431 Yunfei Dong 2021-01-05  548              
lat_buf->slice_bc_addr.size;
0a438b290ea431 Yunfei Dong 2021-01-05  549  
0a438b290ea431 Yunfei Dong 2021-01-05  550      inst->vsi->trans_end = 
inst->ctx->msg_queue.wdma_rptr_addr;
0a438b290ea431 Yunfei Dong 2021-01-05  551      inst->vsi->trans_start = 
inst->ctx->msg_queue.wdma_wptr_addr;
0a438b290ea431 Yunfei Dong 2021-01-05  552      mtk_vcodec_debug(inst, 
"lat:trans(0x%llx 0x%llx)err:0x%llx",
0a438b290ea431 Yunfei Dong 2021-01-05  553              
inst->vsi->wdma_start_addr,
0a438b290ea431 Yunfei Dong 2021-01-05  554              
inst->vsi->wdma_end_addr,
0a438b290ea431 Yunfei Dong 2021-01-05  555              
inst->vsi->wdma_err_addr);
0a438b290ea431 Yunfei Dong 2021-01-05  556  
0a438b290ea431 Yunfei Dong 2021-01-05  557      mtk_vcodec_debug(inst, 
"slice(0x%llx 0x%llx) rprt((0x%llx 0x%llx))",
0a438b290ea431 Yunfei Dong 2021-01-05  558              
inst->vsi->slice_bc_start_addr,
0a438b290ea431 Yunfei Dong 2021-01-05  559              
inst->vsi->slice_bc_end_addr,
0a438b290ea431 Yunfei Dong 2021-01-05  560              inst->vsi->trans_start,
0a438b290ea431 Yunfei Dong 2021-01-05  561              inst->vsi->trans_end);
0a438b290ea431 Yunfei Dong 2021-01-05  562      err = vpu_dec_start(vpu, data, 
2);
0a438b290ea431 Yunfei Dong 2021-01-05  563      if (err) {
0a438b290ea431 Yunfei Dong 2021-01-05  564              mtk_vcodec_debug(inst, 
"lat decode err: %d", err);
0a438b290ea431 Yunfei Dong 2021-01-05  565              goto err_free_fb_out;
0a438b290ea431 Yunfei Dong 2021-01-05  566      }
0a438b290ea431 Yunfei Dong 2021-01-05  567  
0a438b290ea431 Yunfei Dong 2021-01-05  568      if (nal_type == 
NAL_NON_IDR_SLICE || nal_type == NAL_IDR_SLICE) {
0a438b290ea431 Yunfei Dong 2021-01-05  569              /* wait decoder done 
interrupt */
0a438b290ea431 Yunfei Dong 2021-01-05  570              timeout = 
mtk_vcodec_wait_for_done_ctx(
0a438b290ea431 Yunfei Dong 2021-01-05  571                      inst->ctx, 
MTK_INST_IRQ_RECEIVED, WAIT_INTR_TIMEOUT_MS);
0a438b290ea431 Yunfei Dong 2021-01-05  572              inst->vsi->dec.timeout 
= !!timeout;
0a438b290ea431 Yunfei Dong 2021-01-05  573      }

"timeout" not initialized for false path.

0a438b290ea431 Yunfei Dong 2021-01-05  574      err = vpu_dec_end(vpu);
0a438b290ea431 Yunfei Dong 2021-01-05 @575      if (err == SLICE_HEADER_FULL || 
timeout || (err == TRANS_BUFFER_FULL &&
                                                                                
^^^^^^^

0a438b290ea431 Yunfei Dong 2021-01-05  576              
inst->ctx->msg_queue.wdma_rptr_addr ==
0a438b290ea431 Yunfei Dong 2021-01-05  577              
inst->ctx->msg_queue.wdma_wptr_addr)) {
0a438b290ea431 Yunfei Dong 2021-01-05  578              err = -EINVAL;
0a438b290ea431 Yunfei Dong 2021-01-05  579              goto err_free_fb_out;
0a438b290ea431 Yunfei Dong 2021-01-05  580      } else if (err == 
TRANS_BUFFER_FULL){
0a438b290ea431 Yunfei Dong 2021-01-05  581              goto err_free_fb_out;
0a438b290ea431 Yunfei Dong 2021-01-05  582      }
0a438b290ea431 Yunfei Dong 2021-01-05  583  
0a438b290ea431 Yunfei Dong 2021-01-05  584      share_info->trans_end = 
inst->ctx->msg_queue.wdma_addr.dma_addr +
0a438b290ea431 Yunfei Dong 2021-01-05  585              
inst->vsi->wdma_end_addr_offset;
0a438b290ea431 Yunfei Dong 2021-01-05  586      share_info->trans_start = 
inst->ctx->msg_queue.wdma_wptr_addr;
0a438b290ea431 Yunfei Dong 2021-01-05  587      share_info->nal_info = 
inst->vsi->dec.nal_info;
0a438b290ea431 Yunfei Dong 2021-01-05  588      
vdec_msg_queue_update_ube_wptr(&lat_buf->ctx->msg_queue,
0a438b290ea431 Yunfei Dong 2021-01-05  589              share_info->trans_end);
0a438b290ea431 Yunfei Dong 2021-01-05  590  
0a438b290ea431 Yunfei Dong 2021-01-05  591      
memcpy(&share_info->h264_slice_params, &inst->vsi->h264_slice_params,
0a438b290ea431 Yunfei Dong 2021-01-05  592              
sizeof(share_info->h264_slice_params));
0a438b290ea431 Yunfei Dong 2021-01-05  593      
vdec_msg_queue_buf_to_core(inst->ctx->dev, lat_buf);
0a438b290ea431 Yunfei Dong 2021-01-05  594      mtk_vcodec_debug(inst, "- 
NALU[%d] type=%d -\n", inst->num_nalu,
0a438b290ea431 Yunfei Dong 2021-01-05  595                       nal_type);
0a438b290ea431 Yunfei Dong 2021-01-05  596      return 0;
0a438b290ea431 Yunfei Dong 2021-01-05  597  
0a438b290ea431 Yunfei Dong 2021-01-05  598  err_free_fb_out:
0a438b290ea431 Yunfei Dong 2021-01-05  599      if (lat_buf)
0a438b290ea431 Yunfei Dong 2021-01-05  600              
vdec_msg_queue_buf_to_lat(lat_buf);
0a438b290ea431 Yunfei Dong 2021-01-05  601      mtk_vcodec_err(inst, "- 
NALU[%d] err=%d -\n", inst->num_nalu, err);
0a438b290ea431 Yunfei Dong 2021-01-05  602      return err;
0a438b290ea431 Yunfei Dong 2021-01-05  603  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org 
_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org
_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org

Reply via email to