Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [vireshk-pm:cpufreq/arm/linux-next 2/2] drivers/cpufreq/spear-cpufreq.c:202:12: warning: variable 'i' is uninitialized when used here
@ 2024-08-02 21:01 kernel test robot
  2024-08-05 10:47 ` Viresh Kumar
  0 siblings, 1 reply; 5+ messages in thread
From: kernel test robot @ 2024-08-02 21:01 UTC (permalink / raw)
  To: Rob Herring (Arm); +Cc: llvm, oe-kbuild-all, Viresh Kumar

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

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

end of thread, other threads:[~2024-08-06  4:51 UTC | newest]

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

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