Re: [PATCH 4/6] clk: ingenic: Add JZ47xx TCU clocks driver

From: kbuild test robot
Date: Mon Jan 01 2018 - 07:48:21 EST


Hi Paul,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tip/irq/core]
[also build test ERROR on v4.15-rc6 next-20171222]
[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/Paul-Cercueil/Ingenic-JZ47xx-TCU-drivers/20180101-184936
config: mips-qi_lb60_defconfig (attached as .config)
compiler: mipsel-linux-gnu-gcc (Debian 7.2.0-11) 7.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
make.cross ARCH=mips

All errors (new ones prefixed by >>):

drivers/clk//ingenic/tcu.c: In function 'ingenic_tcu_init':
>> drivers/clk//ingenic/tcu.c:293:29: error: 'nb_clocks' undeclared (first use in this function); did you mean 'nb_clks'?
tcu->clocks.clks = kcalloc(nb_clocks, sizeof(struct clk *), GFP_KERNEL);
^~~~~~~~~
nb_clks
drivers/clk//ingenic/tcu.c:293:29: note: each undeclared identifier is reported only once for each function it appears in

vim +293 drivers/clk//ingenic/tcu.c

267
268 static void __init ingenic_tcu_init(struct device_node *np,
269 enum ingenic_version id)
270 {
271 struct ingenic_tcu *tcu;
272 size_t i, nb_clks;
273 int ret = -ENOMEM;
274
275 if (id >= ID_JZ4770)
276 nb_clks = (JZ4770_CLK_LAST - JZ4740_CLK_TIMER0) + 1;
277 else
278 nb_clks = (JZ4740_CLK_LAST - JZ4740_CLK_TIMER0) + 1;
279
280 tcu = kzalloc(sizeof(*tcu), GFP_KERNEL);
281 if (!tcu) {
282 pr_err("%s: cannot allocate memory\n", __func__);
283 return;
284 }
285
286 tcu->map = syscon_node_to_regmap(np->parent);
287 if (IS_ERR(tcu->map)) {
288 pr_err("%s: failed to map TCU registers\n", __func__);
289 goto err_free_tcu;
290 }
291
292 tcu->clocks.clk_num = nb_clks;
> 293 tcu->clocks.clks = kcalloc(nb_clocks, sizeof(struct clk *), GFP_KERNEL);
294 if (!tcu->clocks.clks) {
295 pr_err("%s: cannot allocate memory\n", __func__);
296 goto err_free_tcu;
297 }
298
299 for (i = 0; i < nb_clks; i++) {
300 ret = ingenic_tcu_register_clock(tcu, i,
301 &ingenic_tcu_clk_info[JZ4740_CLK_TIMER0 + i]);
302 if (ret) {
303 pr_err("%s: cannot register clocks\n", __func__);
304 goto err_unregister;
305 }
306 }
307
308 ret = of_clk_add_provider(np, of_clk_src_onecell_get, &tcu->clocks);
309 if (ret) {
310 pr_err("%s: cannot add OF clock provider\n", __func__);
311 goto err_unregister;
312 }
313
314 return;
315
316 err_unregister:
317 for (i = 0; i < tcu->clocks.clk_num; i++)
318 if (tcu->clocks.clks[i])
319 clk_unregister(tcu->clocks.clks[i]);
320 kfree(tcu->clocks.clks);
321 err_free_tcu:
322 kfree(tcu);
323 }
324

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

Attachment: .config.gz
Description: application/gzip