[tip:irq/core 2/2] kernel/irq/irq_sim.c:246 devm_irq_domain_create_sim() warn: passing zero to 'ERR_PTR'

From: Dan Carpenter
Date: Tue Mar 30 2021 - 06:00:37 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
head: e6d46eded43dacf6370a7ae70f927ef4692cfcab
commit: e6d46eded43dacf6370a7ae70f927ef4692cfcab [2/2] genirq/irq_sim: Shrink devm_irq_domain_create_sim()
config: x86_64-randconfig-m001-20210328 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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

smatch warnings:
kernel/irq/irq_sim.c:246 devm_irq_domain_create_sim() warn: passing zero to 'ERR_PTR'

vim +/ERR_PTR +246 kernel/irq/irq_sim.c

337cbeb2c13eb4 Bartosz Golaszewski 2020-05-14 233 struct irq_domain *devm_irq_domain_create_sim(struct device *dev,
337cbeb2c13eb4 Bartosz Golaszewski 2020-05-14 234 struct fwnode_handle *fwnode,
44e72c7ebf2940 Bartosz Golaszewski 2017-08-14 235 unsigned int num_irqs)
44e72c7ebf2940 Bartosz Golaszewski 2017-08-14 236 {
e6d46eded43dac Bartosz Golaszewski 2021-03-01 237 struct irq_domain *domain;
e6d46eded43dac Bartosz Golaszewski 2021-03-01 238 int ret;
44e72c7ebf2940 Bartosz Golaszewski 2017-08-14 239
e6d46eded43dac Bartosz Golaszewski 2021-03-01 240 domain = irq_domain_create_sim(fwnode, num_irqs);
e6d46eded43dac Bartosz Golaszewski 2021-03-01 241 if (IS_ERR(domain))
e6d46eded43dac Bartosz Golaszewski 2021-03-01 242 return domain;
44e72c7ebf2940 Bartosz Golaszewski 2017-08-14 243
e6d46eded43dac Bartosz Golaszewski 2021-03-01 244 ret = devm_add_action_or_reset(dev, devm_irq_domain_remove_sim, domain);
e6d46eded43dac Bartosz Golaszewski 2021-03-01 245 if (!ret)
^^^
This is probably reversed. It should be "if (ret)"

e6d46eded43dac Bartosz Golaszewski 2021-03-01 @246 return ERR_PTR(ret);

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

Attachment: .config.gz
Description: application/gzip