Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
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
Date: Mon, 3 Feb 2025 12:44:58 +0800	[thread overview]
Message-ID: <202502031243.4biWFdNQ-lkp@intel.com> (raw)

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

             reply	other threads:[~2025-02-03  4:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-03  4:44 kernel test robot [this message]
2025-02-03  9:37 ` [broonie-ci:fileaMnh6H 1/9] sound/soc/tegra/tegra_isomgr_bw.c:44:37: warning: variable 'pcm_id' is uninitialized when used here Sheetal .

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202502031243.4biWFdNQ-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=broonie@kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=sheetal@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox