drivers/gpu/drm/vc4/vc4_v3d.c:468 vc4_v3d_bind() warn: 'v3d->clk' not released on lines: 451.
From: Dan Carpenter
Date: Mon Sep 13 2021 - 10:25:41 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 78e709522d2c012cb0daad2e668506637bffb7c2
commit: 5226711e6c413ed069788f1e3f71def9d8d839d6 drm/vc4: Convert to Linux IRQ interfaces
config: openrisc-randconfig-m031-20210912 (attached as .config)
compiler: or1k-linux-gcc (GCC) 11.2.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:
drivers/gpu/drm/vc4/vc4_v3d.c:468 vc4_v3d_bind() warn: 'v3d->clk' not released on lines: 451.
vim +468 drivers/gpu/drm/vc4/vc4_v3d.c
d3f5168a081000 Eric Anholt 2015-03-02 389 static int vc4_v3d_bind(struct device *dev, struct device *master, void *data)
d3f5168a081000 Eric Anholt 2015-03-02 390 {
d3f5168a081000 Eric Anholt 2015-03-02 391 struct platform_device *pdev = to_platform_device(dev);
d3f5168a081000 Eric Anholt 2015-03-02 392 struct drm_device *drm = dev_get_drvdata(master);
d3f5168a081000 Eric Anholt 2015-03-02 393 struct vc4_dev *vc4 = to_vc4_dev(drm);
d3f5168a081000 Eric Anholt 2015-03-02 394 struct vc4_v3d *v3d = NULL;
d5b1a78a772f1e Eric Anholt 2015-11-30 395 int ret;
d3f5168a081000 Eric Anholt 2015-03-02 396
d3f5168a081000 Eric Anholt 2015-03-02 397 v3d = devm_kzalloc(&pdev->dev, sizeof(*v3d), GFP_KERNEL);
d3f5168a081000 Eric Anholt 2015-03-02 398 if (!v3d)
d3f5168a081000 Eric Anholt 2015-03-02 399 return -ENOMEM;
d3f5168a081000 Eric Anholt 2015-03-02 400
001bdb55d9eb72 Eric Anholt 2016-02-05 401 dev_set_drvdata(dev, v3d);
001bdb55d9eb72 Eric Anholt 2016-02-05 402
d3f5168a081000 Eric Anholt 2015-03-02 403 v3d->pdev = pdev;
d3f5168a081000 Eric Anholt 2015-03-02 404
d3f5168a081000 Eric Anholt 2015-03-02 405 v3d->regs = vc4_ioremap_regs(pdev, 0);
d3f5168a081000 Eric Anholt 2015-03-02 406 if (IS_ERR(v3d->regs))
d3f5168a081000 Eric Anholt 2015-03-02 407 return PTR_ERR(v3d->regs);
3051719af11eb4 Eric Anholt 2019-02-20 408 v3d->regset.base = v3d->regs;
3051719af11eb4 Eric Anholt 2019-02-20 409 v3d->regset.regs = v3d_regs;
3051719af11eb4 Eric Anholt 2019-02-20 410 v3d->regset.nregs = ARRAY_SIZE(v3d_regs);
d3f5168a081000 Eric Anholt 2015-03-02 411
d3f5168a081000 Eric Anholt 2015-03-02 412 vc4->v3d = v3d;
001bdb55d9eb72 Eric Anholt 2016-02-05 413 v3d->vc4 = vc4;
d3f5168a081000 Eric Anholt 2015-03-02 414
b72a2816e37114 Eric Anholt 2017-04-28 415 v3d->clk = devm_clk_get(dev, NULL);
b72a2816e37114 Eric Anholt 2017-04-28 416 if (IS_ERR(v3d->clk)) {
b72a2816e37114 Eric Anholt 2017-04-28 417 int ret = PTR_ERR(v3d->clk);
b72a2816e37114 Eric Anholt 2017-04-28 418
b72a2816e37114 Eric Anholt 2017-04-28 419 if (ret == -ENOENT) {
b72a2816e37114 Eric Anholt 2017-04-28 420 /* bcm2835 didn't have a clock reference in the DT. */
b72a2816e37114 Eric Anholt 2017-04-28 421 ret = 0;
b72a2816e37114 Eric Anholt 2017-04-28 422 v3d->clk = NULL;
b72a2816e37114 Eric Anholt 2017-04-28 423 } else {
b72a2816e37114 Eric Anholt 2017-04-28 424 if (ret != -EPROBE_DEFER)
b72a2816e37114 Eric Anholt 2017-04-28 425 dev_err(dev, "Failed to get V3D clock: %d\n",
b72a2816e37114 Eric Anholt 2017-04-28 426 ret);
b72a2816e37114 Eric Anholt 2017-04-28 427 return ret;
b72a2816e37114 Eric Anholt 2017-04-28 428 }
b72a2816e37114 Eric Anholt 2017-04-28 429 }
b72a2816e37114 Eric Anholt 2017-04-28 430
d3f5168a081000 Eric Anholt 2015-03-02 431 if (V3D_READ(V3D_IDENT0) != V3D_EXPECTED_IDENT0) {
d3f5168a081000 Eric Anholt 2015-03-02 432 DRM_ERROR("V3D_IDENT0 read 0x%08x instead of 0x%08x\n",
d3f5168a081000 Eric Anholt 2015-03-02 433 V3D_READ(V3D_IDENT0), V3D_EXPECTED_IDENT0);
d3f5168a081000 Eric Anholt 2015-03-02 434 return -EINVAL;
d3f5168a081000 Eric Anholt 2015-03-02 435 }
d3f5168a081000 Eric Anholt 2015-03-02 436
b72a2816e37114 Eric Anholt 2017-04-28 437 ret = clk_prepare_enable(v3d->clk);
Smatch wants a matching unprepare disable for this.
b72a2816e37114 Eric Anholt 2017-04-28 438 if (ret != 0)
b72a2816e37114 Eric Anholt 2017-04-28 439 return ret;
b72a2816e37114 Eric Anholt 2017-04-28 440
d5b1a78a772f1e Eric Anholt 2015-11-30 441 /* Reset the binner overflow address/size at setup, to be sure
d5b1a78a772f1e Eric Anholt 2015-11-30 442 * we don't reuse an old one.
d5b1a78a772f1e Eric Anholt 2015-11-30 443 */
d5b1a78a772f1e Eric Anholt 2015-11-30 444 V3D_WRITE(V3D_BPOA, 0);
d5b1a78a772f1e Eric Anholt 2015-11-30 445 V3D_WRITE(V3D_BPOS, 0);
d5b1a78a772f1e Eric Anholt 2015-11-30 446
d3f5168a081000 Eric Anholt 2015-03-02 447 vc4_v3d_init_hw(drm);
d3f5168a081000 Eric Anholt 2015-03-02 448
5226711e6c413e Thomas Zimmermann 2021-08-03 449 ret = platform_get_irq(pdev, 0);
5226711e6c413e Thomas Zimmermann 2021-08-03 450 if (ret < 0)
5226711e6c413e Thomas Zimmermann 2021-08-03 451 return ret;
Here.
5226711e6c413e Thomas Zimmermann 2021-08-03 452 vc4->irq = ret;
5226711e6c413e Thomas Zimmermann 2021-08-03 453
5226711e6c413e Thomas Zimmermann 2021-08-03 454 ret = vc4_irq_install(drm, vc4->irq);
d5b1a78a772f1e Eric Anholt 2015-11-30 455 if (ret) {
d5b1a78a772f1e Eric Anholt 2015-11-30 456 DRM_ERROR("Failed to install IRQ handler\n");
d5b1a78a772f1e Eric Anholt 2015-11-30 457 return ret;
d5b1a78a772f1e Eric Anholt 2015-11-30 458 }
d5b1a78a772f1e Eric Anholt 2015-11-30 459
7f696942a7e52d Eric Anholt 2017-05-15 460 pm_runtime_set_active(dev);
3a62234680d86e Eric Anholt 2016-11-04 461 pm_runtime_use_autosuspend(dev);
3a62234680d86e Eric Anholt 2016-11-04 462 pm_runtime_set_autosuspend_delay(dev, 40); /* a little over 2 frames. */
001bdb55d9eb72 Eric Anholt 2016-02-05 463 pm_runtime_enable(dev);
001bdb55d9eb72 Eric Anholt 2016-02-05 464
c9be804c8c7a2d Eric Anholt 2019-04-01 465 vc4_debugfs_add_file(drm, "v3d_ident", vc4_v3d_debugfs_ident, NULL);
c9be804c8c7a2d Eric Anholt 2019-04-01 466 vc4_debugfs_add_regset32(drm, "v3d_regs", &v3d->regset);
c9be804c8c7a2d Eric Anholt 2019-04-01 467
d3f5168a081000 Eric Anholt 2015-03-02 @468 return 0;
d3f5168a081000 Eric Anholt 2015-03-02 469 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx