drivers/clk/ingenic/jz4770-cgu.c:442 jz4770_cgu_init() error: we previously assumed 'cgu' could be null (see line 435)

From: Dan Carpenter
Date: Fri Dec 13 2019 - 05:07:59 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9455d25f4e3b3d009fa1b810862e5b06229530e4
commit: cd94eade0b2ab7673a97223d09406abf668b7f73 clk: ingenic: Allow drivers to be built with COMPILE_TEST
date: 2 weeks ago

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

smatch warnings:
drivers/clk/ingenic/jz4770-cgu.c:442 jz4770_cgu_init() error: we previously assumed 'cgu' could be null (see line 435)

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cd94eade0b2ab7673a97223d09406abf668b7f73
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout cd94eade0b2ab7673a97223d09406abf668b7f73
vim +/cgu +442 drivers/clk/ingenic/jz4770-cgu.c

7a01c19007ad3c Paul Cercueil 2018-01-16 429 static void __init jz4770_cgu_init(struct device_node *np)
7a01c19007ad3c Paul Cercueil 2018-01-16 430 {
7a01c19007ad3c Paul Cercueil 2018-01-16 431 int retval;
7a01c19007ad3c Paul Cercueil 2018-01-16 432
7a01c19007ad3c Paul Cercueil 2018-01-16 433 cgu = ingenic_cgu_new(jz4770_cgu_clocks,
7a01c19007ad3c Paul Cercueil 2018-01-16 434 ARRAY_SIZE(jz4770_cgu_clocks), np);
7a01c19007ad3c Paul Cercueil 2018-01-16 @435 if (!cgu)
7a01c19007ad3c Paul Cercueil 2018-01-16 436 pr_err("%s: failed to initialise CGU\n", __func__);
7a01c19007ad3c Paul Cercueil 2018-01-16 437
7a01c19007ad3c Paul Cercueil 2018-01-16 438 retval = ingenic_cgu_register_clocks(cgu);
7a01c19007ad3c Paul Cercueil 2018-01-16 439 if (retval)
7a01c19007ad3c Paul Cercueil 2018-01-16 440 pr_err("%s: failed to register CGU Clocks\n", __func__);
7a01c19007ad3c Paul Cercueil 2018-01-16 441
2ee93e3c953b72 Paul Cercueil 2019-06-11 @442 ingenic_cgu_register_syscore_ops(cgu);
7a01c19007ad3c Paul Cercueil 2018-01-16 443 }

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