* [PATCH] media: venus: avoid HFI resource leak on IRQ request failure
@ 2026-09-15 12:30 Guangshuo Li
2026-09-16 4:03 ` kernel test robot
2026-09-16 5:17 ` kernel test robot
0 siblings, 2 replies; 3+ messages in thread
From: Guangshuo Li @ 2026-09-15 12:30 UTC (permalink / raw)
To: Vikash Garodia, Dikshita Agarwal, Bryan O'Donoghue,
Mauro Carvalho Chehab, Hans Verkuil, Jorge Ramirez-Ortiz,
linux-media, linux-arm-msm, linux-kernel
Cc: Guangshuo Li, stable
venus_probe() calls hfi_create() before requesting the IRQ, but the IRQ
request failure path does not call hfi_destroy().
The history patch moved hfi_create() before the IRQ request to ensure
that the interrupt handler context is initialized before an interrupt
can be delivered. However, if devm_request_threaded_irq() fails after
hfi_create() succeeds, the error path jumps directly to err_core_put
and leaves the HFI resources allocated.
Request the IRQ with IRQF_NO_AUTOEN before creating the HFI device so
that the interrupt remains disabled during HFI initialization. Enable
the IRQ only after hfi_create() succeeds.
This preserves the protection against interrupts arriving before HFI
initialization while ensuring that an IRQ request failure cannot leak
HFI resources.
This issue was found by manual code inspection.
Fixes: 3200144a2fa4 ("media: venus: protect against spurious interrupts during probe")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
drivers/media/platform/qcom/venus/core.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index 243e342b0ae7..42348bdc2332 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -432,16 +432,19 @@ static int venus_probe(struct platform_device *pdev)
INIT_DELAYED_WORK(&core->work, venus_sys_error_handler);
init_waitqueue_head(&core->sys_err_done);
- ret = hfi_create(core, &venus_core_ops);
+ ret = devm_request_threaded_irq(dev, core->irq, hfi_isr,
+ venus_isr_thread,
+ IRQF_TRIGGER_HIGH | IRQF_ONESHOT |
+ IRQF_NO_AUTOEN, "venus", core);
if (ret)
goto err_core_put;
- ret = devm_request_threaded_irq(dev, core->irq, hfi_isr, venus_isr_thread,
- IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
- "venus", core);
+ ret = hfi_create(core, &venus_core_ops);
if (ret)
goto err_core_put;
+ enable_irq(core->irq);
+
venus_assign_register_offsets(core);
ret = v4l2_device_register(dev, &core->v4l2_dev);
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] media: venus: avoid HFI resource leak on IRQ request failure
2026-09-15 12:30 [PATCH] media: venus: avoid HFI resource leak on IRQ request failure Guangshuo Li
@ 2026-09-16 4:03 ` kernel test robot
2026-09-16 5:17 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-09-16 4:03 UTC (permalink / raw)
To: Guangshuo Li, Vikash Garodia, Dikshita Agarwal,
Bryan O'Donoghue, Mauro Carvalho Chehab, Hans Verkuil,
Jorge Ramirez-Ortiz, linux-arm-msm, linux-kernel
Cc: oe-kbuild-all, linux-media, Guangshuo Li, stable
Hi Guangshuo,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linuxtv-media-pending/master]
[also build test WARNING on media-tree/master linus/master v7.3-rc3 next-20260914]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Guangshuo-Li/media-venus-avoid-HFI-resource-leak-on-IRQ-request-failure/20260915-203009
base: https://git.linuxtv.org/media-ci/media-pending.git master
patch link: https://lore.kernel.org/r/20260915123009.2420780-1-lgs201920130244%40gmail.com
patch subject: [PATCH] media: venus: avoid HFI resource leak on IRQ request failure
config: arm64-defconfig (https://download.01.org/0day-ci/archive/20260916/202609161130.IsnPB09N-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 16.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260916/202609161130.IsnPB09N-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609161130.IsnPB09N-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/media/platform/qcom/venus/core.c: In function 'venus_probe':
>> drivers/media/platform/qcom/venus/core.c:443:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
443 | if (ret)
| ^~
drivers/media/platform/qcom/venus/core.c:446:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
446 | enable_irq(core->irq);
| ^~~~~~~~~~
vim +/if +443 drivers/media/platform/qcom/venus/core.c
687bfbba5a1cb15 Bryan O'Donoghue 2024-12-30 379
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 380 static int venus_probe(struct platform_device *pdev)
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 381 {
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 382 struct device *dev = &pdev->dev;
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 383 struct venus_core *core;
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 384 int ret;
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 385
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 386 core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 387 if (!core)
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 388 return -ENOMEM;
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 389
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 390 core->dev = dev;
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 391
b4dac22d27a2cc4 Cai Huoqing 2021-09-01 392 core->base = devm_platform_ioremap_resource(pdev, 0);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 393 if (IS_ERR(core->base))
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 394 return PTR_ERR(core->base);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 395
5a465c5391a856a Christophe JAILLET 2021-01-28 396 core->video_path = devm_of_icc_get(dev, "video-mem");
32f0a6ddc8c98a1 Stanimir Varbanov 2019-08-13 397 if (IS_ERR(core->video_path))
32f0a6ddc8c98a1 Stanimir Varbanov 2019-08-13 398 return PTR_ERR(core->video_path);
32f0a6ddc8c98a1 Stanimir Varbanov 2019-08-13 399
5a465c5391a856a Christophe JAILLET 2021-01-28 400 core->cpucfg_path = devm_of_icc_get(dev, "cpu-cfg");
32f0a6ddc8c98a1 Stanimir Varbanov 2019-08-13 401 if (IS_ERR(core->cpucfg_path))
32f0a6ddc8c98a1 Stanimir Varbanov 2019-08-13 402 return PTR_ERR(core->cpucfg_path);
32f0a6ddc8c98a1 Stanimir Varbanov 2019-08-13 403
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 404 core->irq = platform_get_irq(pdev, 0);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 405 if (core->irq < 0)
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 406 return core->irq;
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 407
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 408 core->res = of_device_get_match_data(dev);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 409 if (!core->res)
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 410 return -ENODEV;
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 411
63342afea65e9ef Stanimir Varbanov 2020-01-30 412 mutex_init(&core->pm_lock);
63342afea65e9ef Stanimir Varbanov 2020-01-30 413
7482a983dea3b8d Stanimir Varbanov 2019-12-05 414 core->pm_ops = venus_pm_get(core->res->hfi_version);
7482a983dea3b8d Stanimir Varbanov 2019-12-05 415 if (!core->pm_ops)
7482a983dea3b8d Stanimir Varbanov 2019-12-05 416 return -ENODEV;
7482a983dea3b8d Stanimir Varbanov 2019-12-05 417
7482a983dea3b8d Stanimir Varbanov 2019-12-05 418 if (core->pm_ops->core_get) {
08b1cf474b7f727 Bryan O'Donoghue 2021-02-05 419 ret = core->pm_ops->core_get(core);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 420 if (ret)
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 421 return ret;
7482a983dea3b8d Stanimir Varbanov 2019-12-05 422 }
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 423
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 424 ret = dma_set_mask_and_coherent(dev, core->res->dma_mask);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 425 if (ret)
98cd831088c64aa Rajendra Nayak 2020-07-29 426 goto err_core_put;
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 427
0df720e59d9543a Robin Murphy 2020-09-03 428 dma_set_max_seg_size(dev, UINT_MAX);
de2563bce7a157f Vivek Gautam 2018-12-05 429
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 430 INIT_LIST_HEAD(&core->instances);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 431 mutex_init(&core->lock);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 432 INIT_DELAYED_WORK(&core->work, venus_sys_error_handler);
3227a8f7cf331ed Stanimir Varbanov 2021-04-23 433 init_waitqueue_head(&core->sys_err_done);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 434
f7594c2d3a2ae92 Guangshuo Li 2026-09-15 435 ret = devm_request_threaded_irq(dev, core->irq, hfi_isr,
f7594c2d3a2ae92 Guangshuo Li 2026-09-15 436 venus_isr_thread,
f7594c2d3a2ae92 Guangshuo Li 2026-09-15 437 IRQF_TRIGGER_HIGH | IRQF_ONESHOT |
f7594c2d3a2ae92 Guangshuo Li 2026-09-15 438 IRQF_NO_AUTOEN, "venus", core);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 439 if (ret)
98cd831088c64aa Rajendra Nayak 2020-07-29 440 goto err_core_put;
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 441
f7594c2d3a2ae92 Guangshuo Li 2026-09-15 442 ret = hfi_create(core, &venus_core_ops);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 @443 if (ret)
98cd831088c64aa Rajendra Nayak 2020-07-29 444 goto err_core_put;
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 445
f7594c2d3a2ae92 Guangshuo Li 2026-09-15 446 enable_irq(core->irq);
f7594c2d3a2ae92 Guangshuo Li 2026-09-15 447
b4053a2097ec2f8 Bryan O'Donoghue 2021-04-02 448 venus_assign_register_offsets(core);
b4053a2097ec2f8 Bryan O'Donoghue 2021-04-02 449
08b1cf474b7f727 Bryan O'Donoghue 2021-02-05 450 ret = v4l2_device_register(dev, &core->v4l2_dev);
08b1cf474b7f727 Bryan O'Donoghue 2021-02-05 451 if (ret)
523cea3a19f0b3b Loic Poulain 2025-03-27 452 goto err_hfi_destroy;
08b1cf474b7f727 Bryan O'Donoghue 2021-02-05 453
08b1cf474b7f727 Bryan O'Donoghue 2021-02-05 454 platform_set_drvdata(pdev, core);
08b1cf474b7f727 Bryan O'Donoghue 2021-02-05 455
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 456 pm_runtime_enable(dev);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 457
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 458 ret = pm_runtime_get_sync(dev);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 459 if (ret < 0)
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 460 goto err_runtime_disable;
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 461
f9799fcce4bb383 Stanimir Varbanov 2018-10-17 462 ret = venus_firmware_init(core);
f9799fcce4bb383 Stanimir Varbanov 2018-10-17 463 if (ret)
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 464 goto err_runtime_disable;
f9799fcce4bb383 Stanimir Varbanov 2018-10-17 465
a4cf7e3c069db63 Vikash Garodia 2018-10-17 466 ret = venus_boot(core);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 467 if (ret)
8cc7a1b2aca0673 Christophe JAILLET 2021-08-19 468 goto err_firmware_deinit;
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 469
ba4fdff9201190d Jorge Ramirez-Ortiz 2025-08-14 470 ret = venus_firmware_cfg(core);
ba4fdff9201190d Jorge Ramirez-Ortiz 2025-08-14 471 if (ret)
ba4fdff9201190d Jorge Ramirez-Ortiz 2025-08-14 472 goto err_venus_shutdown;
ba4fdff9201190d Jorge Ramirez-Ortiz 2025-08-14 473
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 474 ret = hfi_core_resume(core, true);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 475 if (ret)
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 476 goto err_venus_shutdown;
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 477
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 478 ret = hfi_core_init(core);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 479 if (ret)
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 480 goto err_venus_shutdown;
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 481
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 482 ret = venus_firmware_check(core);
1a73374a04e5551 Stanimir Varbanov 2018-07-06 483 if (ret)
523cea3a19f0b3b Loic Poulain 2025-03-27 484 goto err_core_deinit;
1a73374a04e5551 Stanimir Varbanov 2018-07-06 485
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 486 if (core->res->dec_nodename || core->res->enc_nodename) {
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 487 ret = venus_add_dynamic_nodes(core);
1a73374a04e5551 Stanimir Varbanov 2018-07-06 488 if (ret)
523cea3a19f0b3b Loic Poulain 2025-03-27 489 goto err_core_deinit;
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 490 }
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 491
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 492 ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 493 if (ret)
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 494 goto err_remove_dynamic_nodes;
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 495
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 496 ret = venus_enumerate_codecs(core, VIDC_SESSION_TYPE_DEC);
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 497 if (ret)
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 498 goto err_of_depopulate;
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 499
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 500 ret = venus_enumerate_codecs(core, VIDC_SESSION_TYPE_ENC);
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 501 if (ret)
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 502 goto err_of_depopulate;
1a73374a04e5551 Stanimir Varbanov 2018-07-06 503
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 504 ret = pm_runtime_put_sync(dev);
bbe516e976fce53 Dinghao Liu 2020-06-28 505 if (ret) {
bbe516e976fce53 Dinghao Liu 2020-06-28 506 pm_runtime_get_noresume(dev);
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 507 goto err_of_depopulate;
bbe516e976fce53 Dinghao Liu 2020-06-28 508 }
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 509
f08abe6a1e07fdf Stanimir Varbanov 2020-05-21 510 venus_dbgfs_init(core);
f08abe6a1e07fdf Stanimir Varbanov 2020-05-21 511
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 512 return 0;
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 513
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 514 err_of_depopulate:
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 515 of_platform_depopulate(dev);
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 516 err_remove_dynamic_nodes:
85c853b7043657d Jorge Ramirez-Ortiz 2025-08-14 517 venus_remove_dynamic_nodes(core);
523cea3a19f0b3b Loic Poulain 2025-03-27 518 err_core_deinit:
523cea3a19f0b3b Loic Poulain 2025-03-27 519 hfi_core_deinit(core, false);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 520 err_venus_shutdown:
df381dc8e475204 Vikash Garodia 2018-10-17 521 venus_shutdown(core);
8cc7a1b2aca0673 Christophe JAILLET 2021-08-19 522 err_firmware_deinit:
8cc7a1b2aca0673 Christophe JAILLET 2021-08-19 523 venus_firmware_deinit(core);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 524 err_runtime_disable:
bbe516e976fce53 Dinghao Liu 2020-06-28 525 pm_runtime_put_noidle(dev);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 526 pm_runtime_disable(dev);
2a20869f7d798aa Jinjie Ruan 2024-11-01 527 pm_runtime_set_suspended(dev);
523cea3a19f0b3b Loic Poulain 2025-03-27 528 v4l2_device_unregister(&core->v4l2_dev);
523cea3a19f0b3b Loic Poulain 2025-03-27 529 err_hfi_destroy:
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 530 hfi_destroy(core);
98cd831088c64aa Rajendra Nayak 2020-07-29 531 err_core_put:
98cd831088c64aa Rajendra Nayak 2020-07-29 532 if (core->pm_ops->core_put)
08b1cf474b7f727 Bryan O'Donoghue 2021-02-05 533 core->pm_ops->core_put(core);
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 534 return ret;
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 535 }
af2c3834c8ca7cc Stanimir Varbanov 2017-06-15 536
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] media: venus: avoid HFI resource leak on IRQ request failure
2026-09-15 12:30 [PATCH] media: venus: avoid HFI resource leak on IRQ request failure Guangshuo Li
2026-09-16 4:03 ` kernel test robot
@ 2026-09-16 5:17 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-09-16 5:17 UTC (permalink / raw)
To: Guangshuo Li, Vikash Garodia, Dikshita Agarwal,
Bryan O'Donoghue, Mauro Carvalho Chehab, Hans Verkuil,
Jorge Ramirez-Ortiz, linux-arm-msm, linux-kernel
Cc: llvm, oe-kbuild-all, linux-media, Guangshuo Li, stable
Hi Guangshuo,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linuxtv-media-pending/master]
[also build test WARNING on media-tree/master linus/master v7.3-rc3 next-20260914]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Guangshuo-Li/media-venus-avoid-HFI-resource-leak-on-IRQ-request-failure/20260915-203009
base: https://git.linuxtv.org/media-ci/media-pending.git master
patch link: https://lore.kernel.org/r/20260915123009.2420780-1-lgs201920130244%40gmail.com
patch subject: [PATCH] media: venus: avoid HFI resource leak on IRQ request failure
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20260916/202609161343.qH6ypqkG-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260916/202609161343.qH6ypqkG-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609161343.qH6ypqkG-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/media/platform/qcom/venus/core.c:446:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
446 | enable_irq(core->irq);
| ^
drivers/media/platform/qcom/venus/core.c:443:2: note: previous statement is here
443 | if (ret)
| ^
1 warning generated.
vim +/if +446 drivers/media/platform/qcom/venus/core.c
379
380 static int venus_probe(struct platform_device *pdev)
381 {
382 struct device *dev = &pdev->dev;
383 struct venus_core *core;
384 int ret;
385
386 core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL);
387 if (!core)
388 return -ENOMEM;
389
390 core->dev = dev;
391
392 core->base = devm_platform_ioremap_resource(pdev, 0);
393 if (IS_ERR(core->base))
394 return PTR_ERR(core->base);
395
396 core->video_path = devm_of_icc_get(dev, "video-mem");
397 if (IS_ERR(core->video_path))
398 return PTR_ERR(core->video_path);
399
400 core->cpucfg_path = devm_of_icc_get(dev, "cpu-cfg");
401 if (IS_ERR(core->cpucfg_path))
402 return PTR_ERR(core->cpucfg_path);
403
404 core->irq = platform_get_irq(pdev, 0);
405 if (core->irq < 0)
406 return core->irq;
407
408 core->res = of_device_get_match_data(dev);
409 if (!core->res)
410 return -ENODEV;
411
412 mutex_init(&core->pm_lock);
413
414 core->pm_ops = venus_pm_get(core->res->hfi_version);
415 if (!core->pm_ops)
416 return -ENODEV;
417
418 if (core->pm_ops->core_get) {
419 ret = core->pm_ops->core_get(core);
420 if (ret)
421 return ret;
422 }
423
424 ret = dma_set_mask_and_coherent(dev, core->res->dma_mask);
425 if (ret)
426 goto err_core_put;
427
428 dma_set_max_seg_size(dev, UINT_MAX);
429
430 INIT_LIST_HEAD(&core->instances);
431 mutex_init(&core->lock);
432 INIT_DELAYED_WORK(&core->work, venus_sys_error_handler);
433 init_waitqueue_head(&core->sys_err_done);
434
435 ret = devm_request_threaded_irq(dev, core->irq, hfi_isr,
436 venus_isr_thread,
437 IRQF_TRIGGER_HIGH | IRQF_ONESHOT |
438 IRQF_NO_AUTOEN, "venus", core);
439 if (ret)
440 goto err_core_put;
441
442 ret = hfi_create(core, &venus_core_ops);
443 if (ret)
444 goto err_core_put;
445
> 446 enable_irq(core->irq);
447
448 venus_assign_register_offsets(core);
449
450 ret = v4l2_device_register(dev, &core->v4l2_dev);
451 if (ret)
452 goto err_hfi_destroy;
453
454 platform_set_drvdata(pdev, core);
455
456 pm_runtime_enable(dev);
457
458 ret = pm_runtime_get_sync(dev);
459 if (ret < 0)
460 goto err_runtime_disable;
461
462 ret = venus_firmware_init(core);
463 if (ret)
464 goto err_runtime_disable;
465
466 ret = venus_boot(core);
467 if (ret)
468 goto err_firmware_deinit;
469
470 ret = venus_firmware_cfg(core);
471 if (ret)
472 goto err_venus_shutdown;
473
474 ret = hfi_core_resume(core, true);
475 if (ret)
476 goto err_venus_shutdown;
477
478 ret = hfi_core_init(core);
479 if (ret)
480 goto err_venus_shutdown;
481
482 ret = venus_firmware_check(core);
483 if (ret)
484 goto err_core_deinit;
485
486 if (core->res->dec_nodename || core->res->enc_nodename) {
487 ret = venus_add_dynamic_nodes(core);
488 if (ret)
489 goto err_core_deinit;
490 }
491
492 ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
493 if (ret)
494 goto err_remove_dynamic_nodes;
495
496 ret = venus_enumerate_codecs(core, VIDC_SESSION_TYPE_DEC);
497 if (ret)
498 goto err_of_depopulate;
499
500 ret = venus_enumerate_codecs(core, VIDC_SESSION_TYPE_ENC);
501 if (ret)
502 goto err_of_depopulate;
503
504 ret = pm_runtime_put_sync(dev);
505 if (ret) {
506 pm_runtime_get_noresume(dev);
507 goto err_of_depopulate;
508 }
509
510 venus_dbgfs_init(core);
511
512 return 0;
513
514 err_of_depopulate:
515 of_platform_depopulate(dev);
516 err_remove_dynamic_nodes:
517 venus_remove_dynamic_nodes(core);
518 err_core_deinit:
519 hfi_core_deinit(core, false);
520 err_venus_shutdown:
521 venus_shutdown(core);
522 err_firmware_deinit:
523 venus_firmware_deinit(core);
524 err_runtime_disable:
525 pm_runtime_put_noidle(dev);
526 pm_runtime_disable(dev);
527 pm_runtime_set_suspended(dev);
528 v4l2_device_unregister(&core->v4l2_dev);
529 err_hfi_destroy:
530 hfi_destroy(core);
531 err_core_put:
532 if (core->pm_ops->core_put)
533 core->pm_ops->core_put(core);
534 return ret;
535 }
536
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-16 5:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-15 12:30 [PATCH] media: venus: avoid HFI resource leak on IRQ request failure Guangshuo Li
2026-09-16 4:03 ` kernel test robot
2026-09-16 5:17 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®