Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [broonie-ci:fileaMnh6H 1/9] sound/soc/tegra/tegra_isomgr_bw.c:44:37: warning: variable 'pcm_id' is uninitialized when used here
@ 2025-02-03  4:44 kernel test robot
  2025-02-03  9:37 ` Sheetal .
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2025-02-03  4:44 UTC (permalink / raw)
  To: Sheetal; +Cc: llvm, oe-kbuild-all, Mark Brown

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/ci.git fileaMnh6H
head:   500aea53057a952d584cbe1fa461c7adaaa9f655
commit: 0ecef4e6d1d8e542df8eab71d4aa782bb8ae84e9 [1/9] ASoC: tegra: Add interconnect support
config: arm-randconfig-001-20250203 (https://download.01.org/0day-ci/archive/20250203/202502031243.4biWFdNQ-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250203/202502031243.4biWFdNQ-lkp@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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502031243.4biWFdNQ-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> sound/soc/tegra/tegra_isomgr_bw.c:44:37: warning: variable 'pcm_id' is uninitialized when used here [-Wuninitialized]
      44 |         if ((adma_isomgr->bw_per_dev[type][pcm_id] && is_running) ||
         |                                            ^~~~~~
   sound/soc/tegra/tegra_isomgr_bw.c:25:53: note: initialize the variable 'pcm_id' to silence this warning
      25 |         u32 type = substream->stream, bandwidth = 0, pcm_id;
         |                                                            ^
         |                                                             = 0
   1 warning generated.


vim +/pcm_id +44 sound/soc/tegra/tegra_isomgr_bw.c

    16	
    17	int tegra_isomgr_adma_setbw(struct snd_pcm_substream *substream,
    18				    struct snd_soc_dai *dai, bool is_running)
    19	{
    20		struct device *dev = dai->dev;
    21		struct tegra_admaif *admaif = snd_soc_dai_get_drvdata(dai);
    22		struct tegra_adma_isomgr *adma_isomgr = admaif->adma_isomgr;
    23		struct snd_pcm_runtime *runtime = substream->runtime;
    24		struct snd_pcm *pcm = substream->pcm;
    25		u32 type = substream->stream, bandwidth = 0, pcm_id;
    26		int sample_bytes;
    27	
    28		if (!adma_isomgr)
    29			return 0;
    30	
    31		if (!runtime || !pcm)
    32			return -EINVAL;
    33	
    34		if (pcm->device >= adma_isomgr->max_pcm_device) {
    35			dev_err(dev, "%s: PCM device number %d is greater than %d\n", __func__,
    36				pcm->device, adma_isomgr->max_pcm_device);
    37			return -EINVAL;
    38		}
    39	
    40		/*
    41		 * No action if  stream is running and bandwidth is already set or
    42		 * stream is not running and bandwidth is already reset
    43		 */
  > 44		if ((adma_isomgr->bw_per_dev[type][pcm_id] && is_running) ||
    45		    (!adma_isomgr->bw_per_dev[type][pcm_id] && !is_running))
    46			return 0;
    47	
    48		if (is_running) {
    49			sample_bytes = snd_pcm_format_width(runtime->format) / 8;
    50			if (sample_bytes < 0)
    51				return sample_bytes;
    52	
    53			/* KB/s kilo bytes per sec */
    54			bandwidth = runtime->channels * (runtime->rate / 1000) *
    55					sample_bytes;
    56		}
    57	
    58		mutex_lock(&adma_isomgr->mutex);
    59	
    60		if (is_running) {
    61			if (bandwidth + adma_isomgr->current_bandwidth > adma_isomgr->max_bw)
    62				bandwidth = adma_isomgr->max_bw - adma_isomgr->current_bandwidth;
    63	
    64			adma_isomgr->current_bandwidth += bandwidth;
    65		} else {
    66			adma_isomgr->current_bandwidth -= adma_isomgr->bw_per_dev[type][pcm_id];
    67		}
    68	
    69		mutex_unlock(&adma_isomgr->mutex);
    70	
    71		adma_isomgr->bw_per_dev[type][pcm_id] = bandwidth;
    72	
    73		dev_dbg(dev, "Setting up bandwidth to %d KBps\n", adma_isomgr->current_bandwidth);
    74	
    75		return icc_set_bw(adma_isomgr->icc_path_handle,
    76				  adma_isomgr->current_bandwidth, adma_isomgr->max_bw);
    77	}
    78	EXPORT_SYMBOL(tegra_isomgr_adma_setbw);
    79	

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [broonie-ci:fileaMnh6H 1/9] sound/soc/tegra/tegra_isomgr_bw.c:44:37: warning: variable 'pcm_id' is uninitialized when used here
  2025-02-03  4:44 [broonie-ci:fileaMnh6H 1/9] sound/soc/tegra/tegra_isomgr_bw.c:44:37: warning: variable 'pcm_id' is uninitialized when used here kernel test robot
@ 2025-02-03  9:37 ` Sheetal .
  0 siblings, 0 replies; 2+ messages in thread
From: Sheetal . @ 2025-02-03  9:37 UTC (permalink / raw)
  To: kernel test robot
  Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev, Mark Brown

Thanks for pointing this, will fix it in the patch next version.

Regards,
Sheetal

-----Original Message-----
From: kernel test robot <lkp@intel.com> 
Sent: 03 February 2025 10:15
To: Sheetal . <sheetal@nvidia.com>
Cc: llvm@lists.linux.dev; oe-kbuild-all@lists.linux.dev; Mark Brown <broonie@kernel.org>
Subject: [broonie-ci:fileaMnh6H 1/9] sound/soc/tegra/tegra_isomgr_bw.c:44:37: warning: variable 'pcm_id' is uninitialized when used here

External email: Use caution opening links or attachments


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/ci.git fileaMnh6H
head:   500aea53057a952d584cbe1fa461c7adaaa9f655
commit: 0ecef4e6d1d8e542df8eab71d4aa782bb8ae84e9 [1/9] ASoC: tegra: Add interconnect support
config: arm-randconfig-001-20250203 (https://download.01.org/0day-ci/archive/20250203/202502031243.4biWFdNQ-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250203/202502031243.4biWFdNQ-lkp@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 <lkp@intel.com>
| Closes: 
| https://lore.kernel.org/oe-kbuild-all/202502031243.4biWFdNQ-lkp@intel.
| com/

All warnings (new ones prefixed by >>):

>> sound/soc/tegra/tegra_isomgr_bw.c:44:37: warning: variable 'pcm_id' 
>> is uninitialized when used here [-Wuninitialized]
      44 |         if ((adma_isomgr->bw_per_dev[type][pcm_id] && is_running) ||
         |                                            ^~~~~~
   sound/soc/tegra/tegra_isomgr_bw.c:25:53: note: initialize the variable 'pcm_id' to silence this warning
      25 |         u32 type = substream->stream, bandwidth = 0, pcm_id;
         |                                                            ^
         |                                                             = 0
   1 warning generated.


vim +/pcm_id +44 sound/soc/tegra/tegra_isomgr_bw.c

    16
    17  int tegra_isomgr_adma_setbw(struct snd_pcm_substream *substream,
    18                              struct snd_soc_dai *dai, bool is_running)
    19  {
    20          struct device *dev = dai->dev;
    21          struct tegra_admaif *admaif = snd_soc_dai_get_drvdata(dai);
    22          struct tegra_adma_isomgr *adma_isomgr = admaif->adma_isomgr;
    23          struct snd_pcm_runtime *runtime = substream->runtime;
    24          struct snd_pcm *pcm = substream->pcm;
    25          u32 type = substream->stream, bandwidth = 0, pcm_id;
    26          int sample_bytes;
    27
    28          if (!adma_isomgr)
    29                  return 0;
    30
    31          if (!runtime || !pcm)
    32                  return -EINVAL;
    33
    34          if (pcm->device >= adma_isomgr->max_pcm_device) {
    35                  dev_err(dev, "%s: PCM device number %d is greater than %d\n", __func__,
    36                          pcm->device, adma_isomgr->max_pcm_device);
    37                  return -EINVAL;
    38          }
    39
    40          /*
    41           * No action if  stream is running and bandwidth is already set or
    42           * stream is not running and bandwidth is already reset
    43           */
  > 44          if ((adma_isomgr->bw_per_dev[type][pcm_id] && is_running) ||
    45              (!adma_isomgr->bw_per_dev[type][pcm_id] && !is_running))
    46                  return 0;
    47
    48          if (is_running) {
    49                  sample_bytes = snd_pcm_format_width(runtime->format) / 8;
    50                  if (sample_bytes < 0)
    51                          return sample_bytes;
    52
    53                  /* KB/s kilo bytes per sec */
    54                  bandwidth = runtime->channels * (runtime->rate / 1000) *
    55                                  sample_bytes;
    56          }
    57
    58          mutex_lock(&adma_isomgr->mutex);
    59
    60          if (is_running) {
    61                  if (bandwidth + adma_isomgr->current_bandwidth > adma_isomgr->max_bw)
    62                          bandwidth = adma_isomgr->max_bw - adma_isomgr->current_bandwidth;
    63
    64                  adma_isomgr->current_bandwidth += bandwidth;
    65          } else {
    66                  adma_isomgr->current_bandwidth -= adma_isomgr->bw_per_dev[type][pcm_id];
    67          }
    68
    69          mutex_unlock(&adma_isomgr->mutex);
    70
    71          adma_isomgr->bw_per_dev[type][pcm_id] = bandwidth;
    72
    73          dev_dbg(dev, "Setting up bandwidth to %d KBps\n", adma_isomgr->current_bandwidth);
    74
    75          return icc_set_bw(adma_isomgr->icc_path_handle,
    76                            adma_isomgr->current_bandwidth, adma_isomgr->max_bw);
    77  }
    78  EXPORT_SYMBOL(tegra_isomgr_adma_setbw);
    79

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-03  9:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-03  4:44 [broonie-ci:fileaMnh6H 1/9] sound/soc/tegra/tegra_isomgr_bw.c:44:37: warning: variable 'pcm_id' is uninitialized when used here kernel test robot
2025-02-03  9:37 ` Sheetal .

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox