[staging:staging-next 67/73] drivers/staging/hikey9xx/hi6421-spmi-pmic.c:238 hi6421_spmi_pmic_probe() warn: 'ddata->irq' not released on lines: 238.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-next
head:   06b0c0dce88e2aa2f01343db0f26d214d7f264a0
commit: a2e904fc59e15d9e4128415579a2664ab3a1ed14 [67/73] staging: hikey9xx: hi6421-spmi-pmic: cleanup probe code
config: x86_64-randconfig-m001-20210207 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 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>

New smatch warnings:
drivers/staging/hikey9xx/hi6421-spmi-pmic.c:238 hi6421_spmi_pmic_probe() warn: 'ddata->irq' not released on lines: 238.

Old smatch warnings:
drivers/staging/hikey9xx/hi6421-spmi-pmic.c:52 hi6421_spmi_irq_handler() error: uninitialized symbol 'offset'.

vim +238 drivers/staging/hikey9xx/hi6421-spmi-pmic.c

1eb2784a90925d Mauro Carvalho Chehab 2020-08-17  164  static int hi6421_spmi_pmic_probe(struct spmi_device *pdev)
4524ac56cdcabf Mayulong              2020-08-17  165  {
4524ac56cdcabf Mayulong              2020-08-17  166  	struct device *dev = &pdev->dev;
4524ac56cdcabf Mayulong              2020-08-17  167  	struct device_node *np = dev->of_node;
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  168  	struct hi6421_spmi_pmic *ddata;
4524ac56cdcabf Mayulong              2020-08-17  169  	unsigned int virq;
6b946699252c68 Mauro Carvalho Chehab 2020-08-17  170  	int ret, i;
4524ac56cdcabf Mayulong              2020-08-17  171  
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  172  	ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL);
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  173  	if (!ddata)
4524ac56cdcabf Mayulong              2020-08-17  174  		return -ENOMEM;
4524ac56cdcabf Mayulong              2020-08-17  175  
a2e904fc59e15d Mauro Carvalho Chehab 2021-01-29  176  	ddata->regmap = devm_regmap_init_spmi_ext(pdev, &regmap_config);
a2e904fc59e15d Mauro Carvalho Chehab 2021-01-29  177  	if (IS_ERR(ddata->regmap))
a2e904fc59e15d Mauro Carvalho Chehab 2021-01-29  178  		return PTR_ERR(ddata->regmap);
fb02e3ebfb2da2 Mauro Carvalho Chehab 2021-01-29  179  
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  180  	spin_lock_init(&ddata->lock);
4524ac56cdcabf Mayulong              2020-08-17  181  
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  182  	ddata->dev = dev;
4524ac56cdcabf Mayulong              2020-08-17  183  
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  184  	ddata->gpio = of_get_gpio(np, 0);
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  185  	if (ddata->gpio < 0)
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  186  		return ddata->gpio;
4524ac56cdcabf Mayulong              2020-08-17  187  
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  188  	if (!gpio_is_valid(ddata->gpio))
4524ac56cdcabf Mayulong              2020-08-17  189  		return -EINVAL;
4524ac56cdcabf Mayulong              2020-08-17  190  
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  191  	ret = devm_gpio_request_one(dev, ddata->gpio, GPIOF_IN, "pmic");
4524ac56cdcabf Mayulong              2020-08-17  192  	if (ret < 0) {
a2e904fc59e15d Mauro Carvalho Chehab 2021-01-29  193  		dev_err(dev, "Failed to request gpio%d\n", ddata->gpio);
4524ac56cdcabf Mayulong              2020-08-17  194  		return ret;
4524ac56cdcabf Mayulong              2020-08-17  195  	}
4524ac56cdcabf Mayulong              2020-08-17  196  
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  197  	ddata->irq = gpio_to_irq(ddata->gpio);
4524ac56cdcabf Mayulong              2020-08-17  198  
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  199  	hi6421_spmi_pmic_irq_prc(ddata);
4524ac56cdcabf Mayulong              2020-08-17  200  
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  201  	ddata->irqs = devm_kzalloc(dev, HISI_IRQ_NUM * sizeof(int), GFP_KERNEL);
a2e904fc59e15d Mauro Carvalho Chehab 2021-01-29  202  	if (!ddata->irqs)
a2e904fc59e15d Mauro Carvalho Chehab 2021-01-29  203  		return -ENOMEM;
4524ac56cdcabf Mayulong              2020-08-17  204  
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  205  	ddata->domain = irq_domain_add_simple(np, HISI_IRQ_NUM, 0,
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  206  					     &hi6421_spmi_domain_ops, ddata);
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  207  	if (!ddata->domain) {
a2e904fc59e15d Mauro Carvalho Chehab 2021-01-29  208  		dev_err(dev, "Failed to create IRQ domain\n");
a2e904fc59e15d Mauro Carvalho Chehab 2021-01-29  209  		return -ENODEV;
4524ac56cdcabf Mayulong              2020-08-17  210  	}
4524ac56cdcabf Mayulong              2020-08-17  211  
b240d0143bfbc9 Mauro Carvalho Chehab 2020-08-18  212  	for (i = 0; i < HISI_IRQ_NUM; i++) {
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  213  		virq = irq_create_mapping(ddata->domain, i);
6b946699252c68 Mauro Carvalho Chehab 2020-08-17  214  		if (!virq) {
a2e904fc59e15d Mauro Carvalho Chehab 2021-01-29  215  			dev_err(dev, "Failed to map H/W IRQ\n");
a2e904fc59e15d Mauro Carvalho Chehab 2021-01-29  216  			return -ENOSPC;
4524ac56cdcabf Mayulong              2020-08-17  217  		}
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  218  		ddata->irqs[i] = virq;
4524ac56cdcabf Mayulong              2020-08-17  219  	}
4524ac56cdcabf Mayulong              2020-08-17  220  
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  221  	ret = request_threaded_irq(ddata->irq, hi6421_spmi_irq_handler, NULL,
4524ac56cdcabf Mayulong              2020-08-17  222  				   IRQF_TRIGGER_LOW | IRQF_SHARED | IRQF_NO_SUSPEND,
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  223  				   "pmic", ddata);

Use the devm_request_threaded_irq() version.

4524ac56cdcabf Mayulong              2020-08-17  224  	if (ret < 0) {
a2e904fc59e15d Mauro Carvalho Chehab 2021-01-29  225  		dev_err(dev, "Failed to start IRQ handling thread: error %d\n",
a2e904fc59e15d Mauro Carvalho Chehab 2021-01-29  226  			ret);
a2e904fc59e15d Mauro Carvalho Chehab 2021-01-29  227  		return ret;
4524ac56cdcabf Mayulong              2020-08-17  228  	}
4524ac56cdcabf Mayulong              2020-08-17  229  
fcd732406c5d65 Mauro Carvalho Chehab 2021-01-29  230  	dev_set_drvdata(&pdev->dev, ddata);
cf0f27b7b20b5f Mauro Carvalho Chehab 2020-08-17  231  
cf0f27b7b20b5f Mauro Carvalho Chehab 2020-08-17  232  	ret = devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE,
cf0f27b7b20b5f Mauro Carvalho Chehab 2020-08-17  233  				   hi6421v600_devs, ARRAY_SIZE(hi6421v600_devs),
cf0f27b7b20b5f Mauro Carvalho Chehab 2020-08-17  234  				   NULL, 0, NULL);
a2e904fc59e15d Mauro Carvalho Chehab 2021-01-29  235  	if (ret < 0)
6b946699252c68 Mauro Carvalho Chehab 2020-08-17  236  		dev_err(dev, "Failed to add child devices: %d\n", ret);

Resource leak if devm_mfd_add_devices() fails.

6b946699252c68 Mauro Carvalho Chehab 2020-08-17  237  
4524ac56cdcabf Mayulong              2020-08-17 @238  	return ret;
4524ac56cdcabf Mayulong              2020-08-17  239  }

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

Attachment: .config.gz
Description: application/gzip

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux