All of lore.kernel.org
 help / color / mirror / Atom feed
* [vireshk-pm:opp/linux-next 11/11] drivers/opp/core.c:875:32: warning: variable 'opp' is uninitialized when used here
@ 2020-05-28  3:18 kbuild test robot
  2020-05-28  3:22 ` Viresh Kumar
  0 siblings, 1 reply; 2+ messages in thread
From: kbuild test robot @ 2020-05-28  3:18 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 6805 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git opp/linux-next
head:   c57afacc9270629a03ecb21f956a54886eb81342
commit: c57afacc9270629a03ecb21f956a54886eb81342 [11/11] opp: Remove bandwidth votes when target_freq is zero
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 3393cc4cebf9969db94dc424b7a2b6195589c33b)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        git checkout c57afacc9270629a03ecb21f956a54886eb81342
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

>> drivers/opp/core.c:875:32: warning: variable 'opp' is uninitialized when used here [-Wuninitialized]
ret = _set_opp_bw(opp_table, opp, dev, true);
^~~
drivers/opp/core.c:849:34: note: initialize the variable 'opp' to silence this warning
struct dev_pm_opp *old_opp, *opp;
^
= NULL
1 warning generated.

vim +/opp +875 drivers/opp/core.c

   833	
   834	/**
   835	 * dev_pm_opp_set_rate() - Configure new OPP based on frequency
   836	 * @dev:	 device for which we do this operation
   837	 * @target_freq: frequency to achieve
   838	 *
   839	 * This configures the power-supplies to the levels specified by the OPP
   840	 * corresponding to the target_freq, and programs the clock to a value <=
   841	 * target_freq, as rounded by clk_round_rate(). Device wanting to run@fmax
   842	 * provided by the opp, should have already rounded to the target OPP's
   843	 * frequency.
   844	 */
   845	int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
   846	{
   847		struct opp_table *opp_table;
   848		unsigned long freq, old_freq, temp_freq;
   849		struct dev_pm_opp *old_opp, *opp;
   850		struct clk *clk;
   851		int ret;
   852	
   853		opp_table = _find_opp_table(dev);
   854		if (IS_ERR(opp_table)) {
   855			dev_err(dev, "%s: device opp doesn't exist\n", __func__);
   856			return PTR_ERR(opp_table);
   857		}
   858	
   859		if (unlikely(!target_freq)) {
   860			/*
   861			 * Some drivers need to support cases where some platforms may
   862			 * have OPP table for the device, while others don't and
   863			 * opp_set_rate() just needs to behave like clk_set_rate().
   864			 */
   865			if (!_get_opp_count(opp_table))
   866				return 0;
   867	
   868			if (!opp_table->required_opp_tables && !opp_table->regulators &&
   869			    !opp_table->paths) {
   870				dev_err(dev, "target frequency can't be 0\n");
   871				ret = -EINVAL;
   872				goto put_opp_table;
   873			}
   874	
 > 875			ret = _set_opp_bw(opp_table, opp, dev, true);
   876			if (ret)
   877				return ret;
   878	
   879			if (opp_table->regulator_enabled) {
   880				regulator_disable(opp_table->regulators[0]);
   881				opp_table->regulator_enabled = false;
   882			}
   883	
   884			ret = _set_required_opps(dev, opp_table, NULL);
   885			goto put_opp_table;
   886		}
   887	
   888		clk = opp_table->clk;
   889		if (IS_ERR(clk)) {
   890			dev_err(dev, "%s: No clock available for the device\n",
   891				__func__);
   892			ret = PTR_ERR(clk);
   893			goto put_opp_table;
   894		}
   895	
   896		freq = clk_round_rate(clk, target_freq);
   897		if ((long)freq <= 0)
   898			freq = target_freq;
   899	
   900		old_freq = clk_get_rate(clk);
   901	
   902		/* Return early if nothing to do */
   903		if (old_freq == freq) {
   904			dev_dbg(dev, "%s: old/new frequencies (%lu Hz) are same, nothing to do\n",
   905				__func__, freq);
   906			ret = 0;
   907			goto put_opp_table;
   908		}
   909	
   910		/*
   911		 * For IO devices which require an OPP on some platforms/SoCs
   912		 * while just needing to scale the clock on some others
   913		 * we look for empty OPP tables with just a clock handle and
   914		 * scale only the clk. This makes dev_pm_opp_set_rate()
   915		 * equivalent to a clk_set_rate()
   916		 */
   917		if (!_get_opp_count(opp_table)) {
   918			ret = _generic_set_opp_clk_only(dev, clk, freq);
   919			goto put_opp_table;
   920		}
   921	
   922		temp_freq = old_freq;
   923		old_opp = _find_freq_ceil(opp_table, &temp_freq);
   924		if (IS_ERR(old_opp)) {
   925			dev_err(dev, "%s: failed to find current OPP for freq %lu (%ld)\n",
   926				__func__, old_freq, PTR_ERR(old_opp));
   927		}
   928	
   929		temp_freq = freq;
   930		opp = _find_freq_ceil(opp_table, &temp_freq);
   931		if (IS_ERR(opp)) {
   932			ret = PTR_ERR(opp);
   933			dev_err(dev, "%s: failed to find OPP for freq %lu (%d)\n",
   934				__func__, freq, ret);
   935			goto put_old_opp;
   936		}
   937	
   938		dev_dbg(dev, "%s: switching OPP: %lu Hz --> %lu Hz\n", __func__,
   939			old_freq, freq);
   940	
   941		/* Scaling up? Configure required OPPs before frequency */
   942		if (freq >= old_freq) {
   943			ret = _set_required_opps(dev, opp_table, opp);
   944			if (ret)
   945				goto put_opp;
   946		}
   947	
   948		if (opp_table->set_opp) {
   949			ret = _set_opp_custom(opp_table, dev, old_freq, freq,
   950					      IS_ERR(old_opp) ? NULL : old_opp->supplies,
   951					      opp->supplies);
   952		} else if (opp_table->regulators) {
   953			ret = _generic_set_opp_regulator(opp_table, dev, old_freq, freq,
   954							 IS_ERR(old_opp) ? NULL : old_opp->supplies,
   955							 opp->supplies);
   956		} else {
   957			/* Only frequency scaling */
   958			ret = _generic_set_opp_clk_only(dev, clk, freq);
   959		}
   960	
   961		/* Scaling down? Configure required OPPs after frequency */
   962		if (!ret && freq < old_freq) {
   963			ret = _set_required_opps(dev, opp_table, opp);
   964			if (ret)
   965				dev_err(dev, "Failed to set required opps: %d\n", ret);
   966		}
   967	
   968		if (!ret)
   969			ret = _set_opp_bw(opp_table, opp, dev, false);
   970	
   971	put_opp:
   972		dev_pm_opp_put(opp);
   973	put_old_opp:
   974		if (!IS_ERR(old_opp))
   975			dev_pm_opp_put(old_opp);
   976	put_opp_table:
   977		dev_pm_opp_put_opp_table(opp_table);
   978		return ret;
   979	}
   980	EXPORT_SYMBOL_GPL(dev_pm_opp_set_rate);
   981	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 73541 bytes --]

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

* Re: [vireshk-pm:opp/linux-next 11/11] drivers/opp/core.c:875:32: warning: variable 'opp' is uninitialized when used here
  2020-05-28  3:18 [vireshk-pm:opp/linux-next 11/11] drivers/opp/core.c:875:32: warning: variable 'opp' is uninitialized when used here kbuild test robot
@ 2020-05-28  3:22 ` Viresh Kumar
  0 siblings, 0 replies; 2+ messages in thread
From: Viresh Kumar @ 2020-05-28  3:22 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1531 bytes --]

On 28-05-20, 11:18, kbuild test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git opp/linux-next
> head:   c57afacc9270629a03ecb21f956a54886eb81342
> commit: c57afacc9270629a03ecb21f956a54886eb81342 [11/11] opp: Remove bandwidth votes when target_freq is zero
> config: x86_64-allyesconfig (attached as .config)
> compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 3393cc4cebf9969db94dc424b7a2b6195589c33b)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # install x86_64 cross compiling tool for clang build
>         # apt-get install binutils-x86-64-linux-gnu
>         git checkout c57afacc9270629a03ecb21f956a54886eb81342
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>, old ones prefixed by <<):
> 
> >> drivers/opp/core.c:875:32: warning: variable 'opp' is uninitialized when used here [-Wuninitialized]
> ret = _set_opp_bw(opp_table, opp, dev, true);
> ^~~
> drivers/opp/core.c:849:34: note: initialize the variable 'opp' to silence this warning
> struct dev_pm_opp *old_opp, *opp;
> ^
> = NULL
> 1 warning generated.

Fixed, thanks.

-- 
viresh

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

end of thread, other threads:[~2020-05-28  3:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-28  3:18 [vireshk-pm:opp/linux-next 11/11] drivers/opp/core.c:875:32: warning: variable 'opp' is uninitialized when used here kbuild test robot
2020-05-28  3:22 ` Viresh Kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.