Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: "Rob Herring (Arm)" <robh@kernel.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Viresh Kumar <viresh.kumar@linaro.org>
Subject: [vireshk-pm:cpufreq/arm/linux-next 2/2] drivers/cpufreq/spear-cpufreq.c:202:12: warning: variable 'i' is uninitialized when used here
Date: Sat, 3 Aug 2024 05:01:36 +0800	[thread overview]
Message-ID: <202408030418.gnJDcCpm-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git cpufreq/arm/linux-next
head:   dca2ef2b7d916c718c6e88084170413a8a1942d0
commit: dca2ef2b7d916c718c6e88084170413a8a1942d0 [2/2] cpufreq: spear: Use of_property_for_each_u32() instead of open coding
config: arm-defconfig (https://download.01.org/0day-ci/archive/20240803/202408030418.gnJDcCpm-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240803/202408030418.gnJDcCpm-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/202408030418.gnJDcCpm-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/cpufreq/spear-cpufreq.c:202:12: warning: variable 'i' is uninitialized when used here [-Wuninitialized]
                   freq_tbl[i].frequency = val;
                            ^
   drivers/cpufreq/spear-cpufreq.c:176:12: note: initialize the variable 'i' to silence this warning
           int cnt, i, ret;
                     ^
                      = 0
   1 warning generated.


vim +/i +202 drivers/cpufreq/spear-cpufreq.c

   170	
   171	static int spear_cpufreq_probe(struct platform_device *pdev)
   172	{
   173		struct device_node *np;
   174		struct cpufreq_frequency_table *freq_tbl;
   175		u32 val;
   176		int cnt, i, ret;
   177	
   178		np = of_cpu_device_node_get(0);
   179		if (!np) {
   180			pr_err("No cpu node found\n");
   181			return -ENODEV;
   182		}
   183	
   184		if (of_property_read_u32(np, "clock-latency",
   185					&spear_cpufreq.transition_latency))
   186			spear_cpufreq.transition_latency = CPUFREQ_ETERNAL;
   187	
   188		cnt = of_property_count_u32_elems(np, "cpufreq_tbl");
   189		if (cnt <= 0) {
   190			pr_err("Invalid cpufreq_tbl\n");
   191			ret = -ENODEV;
   192			goto out_put_node;
   193		}
   194	
   195		freq_tbl = kcalloc(cnt + 1, sizeof(*freq_tbl), GFP_KERNEL);
   196		if (!freq_tbl) {
   197			ret = -ENOMEM;
   198			goto out_put_node;
   199		}
   200	
   201		of_property_for_each_u32(np, "cpufreq_tbl", val)
 > 202			freq_tbl[i].frequency = val;
   203	
   204		freq_tbl[cnt].frequency = CPUFREQ_TABLE_END;
   205	
   206		spear_cpufreq.freq_tbl = freq_tbl;
   207	
   208		of_node_put(np);
   209	
   210		spear_cpufreq.clk = clk_get(NULL, "cpu_clk");
   211		if (IS_ERR(spear_cpufreq.clk)) {
   212			pr_err("Unable to get CPU clock\n");
   213			ret = PTR_ERR(spear_cpufreq.clk);
   214			goto out_put_mem;
   215		}
   216	
   217		ret = cpufreq_register_driver(&spear_cpufreq_driver);
   218		if (!ret)
   219			return 0;
   220	
   221		pr_err("failed register driver: %d\n", ret);
   222		clk_put(spear_cpufreq.clk);
   223	
   224	out_put_mem:
   225		kfree(freq_tbl);
   226		return ret;
   227	
   228	out_put_node:
   229		of_node_put(np);
   230		return ret;
   231	}
   232	

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

             reply	other threads:[~2024-08-02 21:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-02 21:01 kernel test robot [this message]
2024-08-05 10:47 ` [vireshk-pm:cpufreq/arm/linux-next 2/2] drivers/cpufreq/spear-cpufreq.c:202:12: warning: variable 'i' is uninitialized when used here Viresh Kumar
2024-08-05 14:00   ` Rob Herring
2024-08-05 23:02     ` Rob Herring
2024-08-06  4:51       ` Viresh Kumar

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=202408030418.gnJDcCpm-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=viresh.kumar@linaro.org \
    /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