* [PATCH] media: bdisp: Fix PM disable depth imbalance in bdisp_probe
@ 2022-01-05 11:41 Miaoqian Lin
2022-01-05 22:27 ` kernel test robot
0 siblings, 1 reply; 3+ messages in thread
From: Miaoqian Lin @ 2022-01-05 11:41 UTC (permalink / raw)
Cc: linmq006, Fabien Dessenne, Mauro Carvalho Chehab, Hans Verkuil,
linux-media, linux-kernel
The pm_runtime_enable will increase power disable depth.
If the probe fails, we should use pm_runtime_disable() to balance
pm_runtime_enable().
Fixes: 28ffeeb ("[media] bdisp: 2D blitter driver using v4l2 mem2mem framework")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/media/platform/sti/bdisp/bdisp-v4l2.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
index 7d467f2ba072..ded4d026f84c 100644
--- a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
+++ b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
@@ -1396,6 +1396,8 @@ static int bdisp_probe(struct platform_device *pdev)
err_remove:
bdisp_debugfs_remove(bdisp);
v4l2_device_unregister(&bdisp->v4l2_dev);
+disable_pm_runtime:
+ pm_runtime_disable(dev);
err_clk:
if (!IS_ERR(bdisp->clock))
clk_unprepare(bdisp->clock);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] media: bdisp: Fix PM disable depth imbalance in bdisp_probe
2022-01-05 11:41 [PATCH] media: bdisp: Fix PM disable depth imbalance in bdisp_probe Miaoqian Lin
@ 2022-01-05 22:27 ` kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-01-05 22:27 UTC (permalink / raw)
To: Miaoqian Lin; +Cc: llvm, kbuild-all
Hi Miaoqian,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on v5.16-rc8]
[also build test WARNING on next-20220105]
[cannot apply to media-tree/master]
[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]
url: https://github.com/0day-ci/linux/commits/Miaoqian-Lin/media-bdisp-Fix-PM-disable-depth-imbalance-in-bdisp_probe/20220105-194236
base: c9e6606c7fe92b50a02ce51dda82586ebdf99b48
config: riscv-randconfig-r022-20220105 (https://download.01.org/0day-ci/archive/20220106/202201060603.USzesOiZ-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d5b6e30ed3acad794dd0aec400e617daffc6cc3d)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/1dafbde5425a5766336413fbcab0bb191145da2e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Miaoqian-Lin/media-bdisp-Fix-PM-disable-depth-imbalance-in-bdisp_probe/20220105-194236
git checkout 1dafbde5425a5766336413fbcab0bb191145da2e
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/media/platform/sti/bdisp/ drivers/media/platform/sti/hva/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/media/platform/sti/bdisp/bdisp-v4l2.c:1399:1: warning: unused label 'disable_pm_runtime' [-Wunused-label]
disable_pm_runtime:
^~~~~~~~~~~~~~~~~~~
1 warning generated.
vim +/disable_pm_runtime +1399 drivers/media/platform/sti/bdisp/bdisp-v4l2.c
1283
1284 static int bdisp_probe(struct platform_device *pdev)
1285 {
1286 struct bdisp_dev *bdisp;
1287 struct resource *res;
1288 struct device *dev = &pdev->dev;
1289 int ret;
1290
1291 dev_dbg(dev, "%s\n", __func__);
1292
1293 bdisp = devm_kzalloc(dev, sizeof(struct bdisp_dev), GFP_KERNEL);
1294 if (!bdisp)
1295 return -ENOMEM;
1296
1297 ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
1298 if (ret)
1299 return ret;
1300
1301 bdisp->pdev = pdev;
1302 bdisp->dev = dev;
1303 platform_set_drvdata(pdev, bdisp);
1304
1305 if (dev->of_node)
1306 bdisp->id = of_alias_get_id(pdev->dev.of_node, BDISP_NAME);
1307 else
1308 bdisp->id = pdev->id;
1309
1310 init_waitqueue_head(&bdisp->irq_queue);
1311 INIT_DELAYED_WORK(&bdisp->timeout_work, bdisp_irq_timeout);
1312 bdisp->work_queue = create_workqueue(BDISP_NAME);
1313
1314 spin_lock_init(&bdisp->slock);
1315 mutex_init(&bdisp->lock);
1316
1317 /* get resources */
1318 bdisp->regs = devm_platform_ioremap_resource(pdev, 0);
1319 if (IS_ERR(bdisp->regs)) {
1320 ret = PTR_ERR(bdisp->regs);
1321 goto err_wq;
1322 }
1323
1324 bdisp->clock = devm_clk_get(dev, BDISP_NAME);
1325 if (IS_ERR(bdisp->clock)) {
1326 dev_err(dev, "failed to get clock\n");
1327 ret = PTR_ERR(bdisp->clock);
1328 goto err_wq;
1329 }
1330
1331 ret = clk_prepare(bdisp->clock);
1332 if (ret < 0) {
1333 dev_err(dev, "clock prepare failed\n");
1334 bdisp->clock = ERR_PTR(-EINVAL);
1335 goto err_wq;
1336 }
1337
1338 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
1339 if (!res) {
1340 dev_err(dev, "failed to get IRQ resource\n");
1341 ret = -EINVAL;
1342 goto err_clk;
1343 }
1344
1345 ret = devm_request_threaded_irq(dev, res->start, bdisp_irq_handler,
1346 bdisp_irq_thread, IRQF_ONESHOT,
1347 pdev->name, bdisp);
1348 if (ret) {
1349 dev_err(dev, "failed to install irq\n");
1350 goto err_clk;
1351 }
1352
1353 /* v4l2 register */
1354 ret = v4l2_device_register(dev, &bdisp->v4l2_dev);
1355 if (ret) {
1356 dev_err(dev, "failed to register\n");
1357 goto err_clk;
1358 }
1359
1360 /* Debug */
1361 bdisp_debugfs_create(bdisp);
1362
1363 /* Power management */
1364 pm_runtime_enable(dev);
1365 ret = pm_runtime_resume_and_get(dev);
1366 if (ret < 0) {
1367 dev_err(dev, "failed to set PM\n");
1368 goto err_remove;
1369 }
1370
1371 /* Filters */
1372 if (bdisp_hw_alloc_filters(bdisp->dev)) {
1373 dev_err(bdisp->dev, "no memory for filters\n");
1374 ret = -ENOMEM;
1375 goto err_pm;
1376 }
1377
1378 /* Register */
1379 ret = bdisp_register_device(bdisp);
1380 if (ret) {
1381 dev_err(dev, "failed to register\n");
1382 goto err_filter;
1383 }
1384
1385 dev_info(dev, "%s%d registered as /dev/video%d\n", BDISP_NAME,
1386 bdisp->id, bdisp->vdev.num);
1387
1388 pm_runtime_put(dev);
1389
1390 return 0;
1391
1392 err_filter:
1393 bdisp_hw_free_filters(bdisp->dev);
1394 err_pm:
1395 pm_runtime_put(dev);
1396 err_remove:
1397 bdisp_debugfs_remove(bdisp);
1398 v4l2_device_unregister(&bdisp->v4l2_dev);
> 1399 disable_pm_runtime:
1400 pm_runtime_disable(dev);
1401 err_clk:
1402 if (!IS_ERR(bdisp->clock))
1403 clk_unprepare(bdisp->clock);
1404 err_wq:
1405 destroy_workqueue(bdisp->work_queue);
1406 return ret;
1407 }
1408
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] media: bdisp: Fix PM disable depth imbalance in bdisp_probe
@ 2022-01-05 22:27 ` kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-01-05 22:27 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 5975 bytes --]
Hi Miaoqian,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on v5.16-rc8]
[also build test WARNING on next-20220105]
[cannot apply to media-tree/master]
[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]
url: https://github.com/0day-ci/linux/commits/Miaoqian-Lin/media-bdisp-Fix-PM-disable-depth-imbalance-in-bdisp_probe/20220105-194236
base: c9e6606c7fe92b50a02ce51dda82586ebdf99b48
config: riscv-randconfig-r022-20220105 (https://download.01.org/0day-ci/archive/20220106/202201060603.USzesOiZ-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d5b6e30ed3acad794dd0aec400e617daffc6cc3d)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/1dafbde5425a5766336413fbcab0bb191145da2e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Miaoqian-Lin/media-bdisp-Fix-PM-disable-depth-imbalance-in-bdisp_probe/20220105-194236
git checkout 1dafbde5425a5766336413fbcab0bb191145da2e
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/media/platform/sti/bdisp/ drivers/media/platform/sti/hva/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/media/platform/sti/bdisp/bdisp-v4l2.c:1399:1: warning: unused label 'disable_pm_runtime' [-Wunused-label]
disable_pm_runtime:
^~~~~~~~~~~~~~~~~~~
1 warning generated.
vim +/disable_pm_runtime +1399 drivers/media/platform/sti/bdisp/bdisp-v4l2.c
1283
1284 static int bdisp_probe(struct platform_device *pdev)
1285 {
1286 struct bdisp_dev *bdisp;
1287 struct resource *res;
1288 struct device *dev = &pdev->dev;
1289 int ret;
1290
1291 dev_dbg(dev, "%s\n", __func__);
1292
1293 bdisp = devm_kzalloc(dev, sizeof(struct bdisp_dev), GFP_KERNEL);
1294 if (!bdisp)
1295 return -ENOMEM;
1296
1297 ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
1298 if (ret)
1299 return ret;
1300
1301 bdisp->pdev = pdev;
1302 bdisp->dev = dev;
1303 platform_set_drvdata(pdev, bdisp);
1304
1305 if (dev->of_node)
1306 bdisp->id = of_alias_get_id(pdev->dev.of_node, BDISP_NAME);
1307 else
1308 bdisp->id = pdev->id;
1309
1310 init_waitqueue_head(&bdisp->irq_queue);
1311 INIT_DELAYED_WORK(&bdisp->timeout_work, bdisp_irq_timeout);
1312 bdisp->work_queue = create_workqueue(BDISP_NAME);
1313
1314 spin_lock_init(&bdisp->slock);
1315 mutex_init(&bdisp->lock);
1316
1317 /* get resources */
1318 bdisp->regs = devm_platform_ioremap_resource(pdev, 0);
1319 if (IS_ERR(bdisp->regs)) {
1320 ret = PTR_ERR(bdisp->regs);
1321 goto err_wq;
1322 }
1323
1324 bdisp->clock = devm_clk_get(dev, BDISP_NAME);
1325 if (IS_ERR(bdisp->clock)) {
1326 dev_err(dev, "failed to get clock\n");
1327 ret = PTR_ERR(bdisp->clock);
1328 goto err_wq;
1329 }
1330
1331 ret = clk_prepare(bdisp->clock);
1332 if (ret < 0) {
1333 dev_err(dev, "clock prepare failed\n");
1334 bdisp->clock = ERR_PTR(-EINVAL);
1335 goto err_wq;
1336 }
1337
1338 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
1339 if (!res) {
1340 dev_err(dev, "failed to get IRQ resource\n");
1341 ret = -EINVAL;
1342 goto err_clk;
1343 }
1344
1345 ret = devm_request_threaded_irq(dev, res->start, bdisp_irq_handler,
1346 bdisp_irq_thread, IRQF_ONESHOT,
1347 pdev->name, bdisp);
1348 if (ret) {
1349 dev_err(dev, "failed to install irq\n");
1350 goto err_clk;
1351 }
1352
1353 /* v4l2 register */
1354 ret = v4l2_device_register(dev, &bdisp->v4l2_dev);
1355 if (ret) {
1356 dev_err(dev, "failed to register\n");
1357 goto err_clk;
1358 }
1359
1360 /* Debug */
1361 bdisp_debugfs_create(bdisp);
1362
1363 /* Power management */
1364 pm_runtime_enable(dev);
1365 ret = pm_runtime_resume_and_get(dev);
1366 if (ret < 0) {
1367 dev_err(dev, "failed to set PM\n");
1368 goto err_remove;
1369 }
1370
1371 /* Filters */
1372 if (bdisp_hw_alloc_filters(bdisp->dev)) {
1373 dev_err(bdisp->dev, "no memory for filters\n");
1374 ret = -ENOMEM;
1375 goto err_pm;
1376 }
1377
1378 /* Register */
1379 ret = bdisp_register_device(bdisp);
1380 if (ret) {
1381 dev_err(dev, "failed to register\n");
1382 goto err_filter;
1383 }
1384
1385 dev_info(dev, "%s%d registered as /dev/video%d\n", BDISP_NAME,
1386 bdisp->id, bdisp->vdev.num);
1387
1388 pm_runtime_put(dev);
1389
1390 return 0;
1391
1392 err_filter:
1393 bdisp_hw_free_filters(bdisp->dev);
1394 err_pm:
1395 pm_runtime_put(dev);
1396 err_remove:
1397 bdisp_debugfs_remove(bdisp);
1398 v4l2_device_unregister(&bdisp->v4l2_dev);
> 1399 disable_pm_runtime:
1400 pm_runtime_disable(dev);
1401 err_clk:
1402 if (!IS_ERR(bdisp->clock))
1403 clk_unprepare(bdisp->clock);
1404 err_wq:
1405 destroy_workqueue(bdisp->work_queue);
1406 return ret;
1407 }
1408
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-05 22:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05 11:41 [PATCH] media: bdisp: Fix PM disable depth imbalance in bdisp_probe Miaoqian Lin
2022-01-05 22:27 ` kernel test robot
2022-01-05 22:27 ` kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.