[kbuild] [chrome-os:chromeos-5.4 54/243] drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_lat_if.c:575:34: warning: Uninitialized variable: timeout [uninitvar]

2021-04-20 Thread Dan Carpenter
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 

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 = 
>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, >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(>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(>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(_buf_info->m2m_buf.vb,
0a438b290ea431 Yunfei Dong 2021-01-05  524  _buf->ts_info, 
true);
0a438b290ea431 Yunfei Dong 2021-01-05  

[kbuild] [chrome-os:chromeos-5.4 54/243] drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_lat_if.c:575:34: warning: Uninitialized variable: timeout [uninitvar]

2021-04-17 Thread kernel test robot
CC: kbuild-...@lists.01.org
TO: cros-kernel-buildrepo...@googlegroups.com
TO: Guenter Roeck 

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
:: branch date: 2 hours ago
:: commit date: 32 hours ago
compiler: hppa-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 


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  472  
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 = 
>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, >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(>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(>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