Hi Shengjiu,

kernel test robot noticed the following build warnings:

[auto build test WARNING on media-tree/master]
[also build test WARNING on broonie-sound/for-next tiwai-sound/for-next 
tiwai-sound/for-linus linus/master v6.6 next-20231110]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    
https://github.com/intel-lab-lkp/linux/commits/Shengjiu-Wang/ASoC-fsl_asrc-define-functions-for-memory-to-memory-usage/20231110-143635
base:   git://linuxtv.org/media_tree.git master
patch link:    
https://lore.kernel.org/r/1699595289-25773-16-git-send-email-shengjiu.wang%40nxp.com
patch subject: [PATCH v9 15/15] media: vim2m-audio: add virtual driver for 
audio memory to memory
config: powerpc64-allyesconfig 
(https://download.01.org/0day-ci/archive/20231111/202311110805.xhszmzn7-...@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 
4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20231111/202311110805.xhszmzn7-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <l...@intel.com>
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202311110805.xhszmzn7-...@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/media/test-drivers/vim2m-audio.c:174:13: warning: variable 
>> 'dst_size' is used uninitialized whenever 'if' condition is false 
>> [-Wsometimes-uninitialized]
     174 |         } else if (q_data_src->rate * 2 == q_data_dst->rate) {
         |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/test-drivers/vim2m-audio.c:184:46: note: uninitialized use 
occurs here
     184 |         vb2_set_plane_payload(&dst_buf->vb2_buf, 0, dst_size);
         |                                                     ^~~~~~~~
   drivers/media/test-drivers/vim2m-audio.c:174:9: note: remove the 'if' if its 
condition is always true
     174 |         } else if (q_data_src->rate * 2 == q_data_dst->rate) {
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/test-drivers/vim2m-audio.c:137:24: note: initialize the 
variable 'dst_size' to silence this warning
     137 |         int src_size, dst_size;
         |                               ^
         |                                = 0
   1 warning generated.


vim +174 drivers/media/test-drivers/vim2m-audio.c

   123  
   124  /*
   125   * mem2mem callbacks
   126   */
   127  
   128  /*
   129   * device_run() - prepares and starts the device
   130   */
   131  static void device_run(void *priv)
   132  {
   133          struct audm2m_ctx *ctx = priv;
   134          struct audm2m_dev *audm2m_dev;
   135          struct vb2_v4l2_buffer *src_buf, *dst_buf;
   136          struct audm2m_q_data *q_data_src, *q_data_dst;
   137          int src_size, dst_size;
   138          short *src_addr, *dst_addr;
   139          int i;
   140  
   141          audm2m_dev = ctx->dev;
   142  
   143          q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_AUDIO_OUTPUT);
   144          if (!q_data_src)
   145                  return;
   146  
   147          q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_AUDIO_CAPTURE);
   148          if (!q_data_dst)
   149                  return;
   150  
   151          src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
   152          dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
   153          src_buf->sequence = q_data_src->sequence++;
   154          dst_buf->sequence = q_data_dst->sequence++;
   155          v4l2_m2m_buf_copy_metadata(src_buf, dst_buf, false);
   156  
   157          /* Process the conversion */
   158          src_size = vb2_get_plane_payload(&src_buf->vb2_buf, 0);
   159  
   160          src_addr = vb2_plane_vaddr(&src_buf->vb2_buf, 0);
   161          dst_addr = vb2_plane_vaddr(&dst_buf->vb2_buf, 0);
   162  
   163          if (q_data_src->rate == q_data_dst->rate) {
   164                  memcpy(dst_addr, src_addr, src_size);
   165                  dst_size = src_size;
   166          } else if (q_data_src->rate == 2 * q_data_dst->rate) {
   167                  /* 8k to 16k */
   168                  for (i = 0; i < src_size / 2; i++) {
   169                          *dst_addr++ = *src_addr++;
   170                          src_addr++;
   171                  }
   172  
   173                  dst_size = src_size / 2;
 > 174          } else if (q_data_src->rate * 2 == q_data_dst->rate) {
   175                  /* 16k to 8k */
   176                  for (i = 0; i < src_size / 2; i++) {
   177                          *dst_addr++ = *src_addr;
   178                          *dst_addr++ = *src_addr++;
   179                  }
   180  
   181                  dst_size = src_size * 2;
   182          }
   183  
   184          vb2_set_plane_payload(&dst_buf->vb2_buf, 0, dst_size);
   185  
   186          src_buf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx);
   187          dst_buf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx);
   188  
   189          v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE);
   190          v4l2_m2m_buf_done(dst_buf, VB2_BUF_STATE_DONE);
   191          v4l2_m2m_job_finish(audm2m_dev->m2m_dev, ctx->fh.m2m_ctx);
   192  }
   193  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Reply via email to