Re: [PATCH 2/2] cpufreq: dt: rework resources initialization

kbuild test robot
2019-02-08T01:26:55Z

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

Hi Marek,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pm/linux-next]
[also build test WARNING on next-20190207]
[cannot apply to v5.0-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Marek-Szyprowski/cpufreq-opp-rework-regulator-initialization/20190208-071454
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 8.2.0-11) 8.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=8.2.0 make.cross ARCH=sh

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

drivers//cpufreq/cpufreq-dt.c: In function 'dt_cpufreq_probe':
>> drivers//cpufreq/cpufreq-dt.c:149:12: warning: 'cpu_reg' may be used uninitialized in this function [-Wmaybe-uninitialized]
priv->reg = cpu_reg;
~~~~~~~~~~^~~~~~~~~
drivers//cpufreq/cpufreq-dt.c:102:20: note: 'cpu_reg' was declared here
struct regulator *cpu_reg;
^~~~~~~

vim +/cpu_reg +149 drivers//cpufreq/cpufreq-dt.c

98
99 static int get_cpu_resources(struct private_data *priv, unsigned int cpu)
100 {
101 struct device *cpu_dev;
102 struct regulator *cpu_reg;
103 struct clk *cpu_clk;
104 int ret = 0;
105 const char *name;
106
107 cpu_dev = get_cpu_device(cpu);
108 if (!cpu_dev) {
109 pr_err("failed to get cpu%d device\n", cpu);
110 return -ENODEV;
111 }
112
113 cpu_clk = clk_get(cpu_dev, NULL);
114 ret = PTR_ERR_OR_ZERO(cpu_clk);
115 if (ret) {
116 /*
117 * If cpu's clk node is present, but clock is not yet
118 * registered, we should try defering probe.
119 */
120 if (ret == -EPROBE_DEFER)
121 dev_dbg(cpu_dev, "clock not ready, retry\n");
122 else
123 dev_err(cpu_dev, "failed to get clock: %d\n", ret);
124
125 return ret;
126 }
127
128 name = find_supply_name(cpu_dev);
129 /* Platform doesn't require regulator */
130 if (!name)
131 goto no_regulator;
132
133 cpu_reg = regulator_get_optional(cpu_dev, name);
134 ret = PTR_ERR_OR_ZERO(cpu_reg);
135 if (ret) {
136 /*
137 * If cpu's regulator supply node is present, but regulator is
138 * not yet registered, we should try defering probe.
139 */
140 if (ret == -EPROBE_DEFER)
141 dev_dbg(cpu_dev, "regulator not ready, retry\n");
142 else
143 dev_dbg(cpu_dev, "no regulator for cpu: %d\n", ret);
144 goto free;
145 }
146 no_regulator:
147 priv->cpu_dev = cpu_dev;
148 priv->clk = cpu_clk;
> 149 priv->reg = cpu_reg;
150 return 0;
151 free:
152 clk_put(cpu_clk);
153 return ret;
154 }
155

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

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