All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: st-hva: Fix PM disable depth imbalance in hva_hw_probe
@ 2022-01-05 11:31 Miaoqian Lin
  2022-01-05 23:59   ` kernel test robot
  0 siblings, 1 reply; 3+ messages in thread
From: Miaoqian Lin @ 2022-01-05 11:31 UTC (permalink / raw)
  Cc: linmq006, Jean-Christophe Trotin, Mauro Carvalho Chehab,
	Peter Griffin, Yannick Fertre, 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: 57b2c06 ("[media] st-hva: multi-format video encoder V4L2 driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/media/platform/sti/hva/hva-hw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/sti/hva/hva-hw.c b/drivers/media/platform/sti/hva/hva-hw.c
index 15e8f83b1b56..bef880951921 100644
--- a/drivers/media/platform/sti/hva/hva-hw.c
+++ b/drivers/media/platform/sti/hva/hva-hw.c
@@ -406,7 +406,8 @@ int hva_hw_probe(struct platform_device *pdev, struct hva_dev *hva)
 err_clk:
 	if (hva->clk)
 		clk_unprepare(hva->clk);
-
+disable_pm_runtime:
+	pm_runtime_disable(dev);
 	return ret;
 }
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: st-hva: Fix PM disable depth imbalance in hva_hw_probe
  2022-01-05 11:31 [PATCH] media: st-hva: Fix PM disable depth imbalance in hva_hw_probe Miaoqian Lin
@ 2022-01-05 23:59   ` kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-01-05 23:59 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: llvm, kbuild-all, linmq006, Jean-Christophe Trotin,
	Mauro Carvalho Chehab, linux-media, Peter Griffin,
	Yannick Fertre, Hans Verkuil, linux-kernel

Hi Miaoqian,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on media-tree/master]
[also build test WARNING on v5.16-rc8 next-20220105]
[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-st-hva-Fix-PM-disable-depth-imbalance-in-hva_hw_probe/20220105-193232
base:   git://linuxtv.org/media_tree.git master
config: riscv-randconfig-r022-20220105 (https://download.01.org/0day-ci/archive/20220106/202201060723.hf79WNhw-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/47b1ca3ed69ff8b4ac772d1630776ec5366076c1
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Miaoqian-Lin/media-st-hva-Fix-PM-disable-depth-imbalance-in-hva_hw_probe/20220105-193232
        git checkout 47b1ca3ed69ff8b4ac772d1630776ec5366076c1
        # 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/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/hva/hva-hw.c:411:1: warning: unused label 'disable_pm_runtime' [-Wunused-label]
   disable_pm_runtime:
   ^~~~~~~~~~~~~~~~~~~
   1 warning generated.


vim +/disable_pm_runtime +411 drivers/media/platform/sti/hva/hva-hw.c

   297	
   298	int hva_hw_probe(struct platform_device *pdev, struct hva_dev *hva)
   299	{
   300		struct device *dev = &pdev->dev;
   301		struct resource *esram;
   302		int ret;
   303	
   304		WARN_ON(!hva);
   305	
   306		/* get memory for registers */
   307		hva->regs = devm_platform_ioremap_resource(pdev, 0);
   308		if (IS_ERR(hva->regs)) {
   309			dev_err(dev, "%s     failed to get regs\n", HVA_PREFIX);
   310			return PTR_ERR(hva->regs);
   311		}
   312	
   313		/* get memory for esram */
   314		esram = platform_get_resource(pdev, IORESOURCE_MEM, 1);
   315		if (!esram) {
   316			dev_err(dev, "%s     failed to get esram\n", HVA_PREFIX);
   317			return -ENODEV;
   318		}
   319		hva->esram_addr = esram->start;
   320		hva->esram_size = resource_size(esram);
   321	
   322		dev_info(dev, "%s     esram reserved for address: 0x%x size:%d\n",
   323			 HVA_PREFIX, hva->esram_addr, hva->esram_size);
   324	
   325		/* get clock resource */
   326		hva->clk = devm_clk_get(dev, "clk_hva");
   327		if (IS_ERR(hva->clk)) {
   328			dev_err(dev, "%s     failed to get clock\n", HVA_PREFIX);
   329			return PTR_ERR(hva->clk);
   330		}
   331	
   332		ret = clk_prepare(hva->clk);
   333		if (ret < 0) {
   334			dev_err(dev, "%s     failed to prepare clock\n", HVA_PREFIX);
   335			hva->clk = ERR_PTR(-EINVAL);
   336			return ret;
   337		}
   338	
   339		/* get status interruption resource */
   340		ret  = platform_get_irq(pdev, 0);
   341		if (ret < 0)
   342			goto err_clk;
   343		hva->irq_its = ret;
   344	
   345		ret = devm_request_threaded_irq(dev, hva->irq_its, hva_hw_its_interrupt,
   346						hva_hw_its_irq_thread,
   347						IRQF_ONESHOT,
   348						"hva_its_irq", hva);
   349		if (ret) {
   350			dev_err(dev, "%s     failed to install status IRQ 0x%x\n",
   351				HVA_PREFIX, hva->irq_its);
   352			goto err_clk;
   353		}
   354		disable_irq(hva->irq_its);
   355	
   356		/* get error interruption resource */
   357		ret = platform_get_irq(pdev, 1);
   358		if (ret < 0)
   359			goto err_clk;
   360		hva->irq_err = ret;
   361	
   362		ret = devm_request_threaded_irq(dev, hva->irq_err, hva_hw_err_interrupt,
   363						hva_hw_err_irq_thread,
   364						IRQF_ONESHOT,
   365						"hva_err_irq", hva);
   366		if (ret) {
   367			dev_err(dev, "%s     failed to install error IRQ 0x%x\n",
   368				HVA_PREFIX, hva->irq_err);
   369			goto err_clk;
   370		}
   371		disable_irq(hva->irq_err);
   372	
   373		/* initialise protection mutex */
   374		mutex_init(&hva->protect_mutex);
   375	
   376		/* initialise completion signal */
   377		init_completion(&hva->interrupt);
   378	
   379		/* initialise runtime power management */
   380		pm_runtime_set_autosuspend_delay(dev, AUTOSUSPEND_DELAY_MS);
   381		pm_runtime_use_autosuspend(dev);
   382		pm_runtime_set_suspended(dev);
   383		pm_runtime_enable(dev);
   384	
   385		ret = pm_runtime_resume_and_get(dev);
   386		if (ret < 0) {
   387			dev_err(dev, "%s     failed to set PM\n", HVA_PREFIX);
   388			goto err_disable;
   389		}
   390	
   391		/* check IP hardware version */
   392		hva->ip_version = hva_hw_get_ip_version(hva);
   393	
   394		if (hva->ip_version == HVA_VERSION_UNKNOWN) {
   395			ret = -EINVAL;
   396			goto err_pm;
   397		}
   398	
   399		dev_info(dev, "%s     found hva device (version 0x%lx)\n", HVA_PREFIX,
   400			 hva->ip_version);
   401	
   402		return 0;
   403	
   404	err_pm:
   405		pm_runtime_put(dev);
   406	err_disable:
   407		pm_runtime_disable(dev);
   408	err_clk:
   409		if (hva->clk)
   410			clk_unprepare(hva->clk);
 > 411	disable_pm_runtime:
   412		pm_runtime_disable(dev);
   413		return ret;
   414	}
   415	

---
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: st-hva: Fix PM disable depth imbalance in hva_hw_probe
@ 2022-01-05 23:59   ` kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-01-05 23:59 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 6015 bytes --]

Hi Miaoqian,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on media-tree/master]
[also build test WARNING on v5.16-rc8 next-20220105]
[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-st-hva-Fix-PM-disable-depth-imbalance-in-hva_hw_probe/20220105-193232
base:   git://linuxtv.org/media_tree.git master
config: riscv-randconfig-r022-20220105 (https://download.01.org/0day-ci/archive/20220106/202201060723.hf79WNhw-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/47b1ca3ed69ff8b4ac772d1630776ec5366076c1
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Miaoqian-Lin/media-st-hva-Fix-PM-disable-depth-imbalance-in-hva_hw_probe/20220105-193232
        git checkout 47b1ca3ed69ff8b4ac772d1630776ec5366076c1
        # 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/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/hva/hva-hw.c:411:1: warning: unused label 'disable_pm_runtime' [-Wunused-label]
   disable_pm_runtime:
   ^~~~~~~~~~~~~~~~~~~
   1 warning generated.


vim +/disable_pm_runtime +411 drivers/media/platform/sti/hva/hva-hw.c

   297	
   298	int hva_hw_probe(struct platform_device *pdev, struct hva_dev *hva)
   299	{
   300		struct device *dev = &pdev->dev;
   301		struct resource *esram;
   302		int ret;
   303	
   304		WARN_ON(!hva);
   305	
   306		/* get memory for registers */
   307		hva->regs = devm_platform_ioremap_resource(pdev, 0);
   308		if (IS_ERR(hva->regs)) {
   309			dev_err(dev, "%s     failed to get regs\n", HVA_PREFIX);
   310			return PTR_ERR(hva->regs);
   311		}
   312	
   313		/* get memory for esram */
   314		esram = platform_get_resource(pdev, IORESOURCE_MEM, 1);
   315		if (!esram) {
   316			dev_err(dev, "%s     failed to get esram\n", HVA_PREFIX);
   317			return -ENODEV;
   318		}
   319		hva->esram_addr = esram->start;
   320		hva->esram_size = resource_size(esram);
   321	
   322		dev_info(dev, "%s     esram reserved for address: 0x%x size:%d\n",
   323			 HVA_PREFIX, hva->esram_addr, hva->esram_size);
   324	
   325		/* get clock resource */
   326		hva->clk = devm_clk_get(dev, "clk_hva");
   327		if (IS_ERR(hva->clk)) {
   328			dev_err(dev, "%s     failed to get clock\n", HVA_PREFIX);
   329			return PTR_ERR(hva->clk);
   330		}
   331	
   332		ret = clk_prepare(hva->clk);
   333		if (ret < 0) {
   334			dev_err(dev, "%s     failed to prepare clock\n", HVA_PREFIX);
   335			hva->clk = ERR_PTR(-EINVAL);
   336			return ret;
   337		}
   338	
   339		/* get status interruption resource */
   340		ret  = platform_get_irq(pdev, 0);
   341		if (ret < 0)
   342			goto err_clk;
   343		hva->irq_its = ret;
   344	
   345		ret = devm_request_threaded_irq(dev, hva->irq_its, hva_hw_its_interrupt,
   346						hva_hw_its_irq_thread,
   347						IRQF_ONESHOT,
   348						"hva_its_irq", hva);
   349		if (ret) {
   350			dev_err(dev, "%s     failed to install status IRQ 0x%x\n",
   351				HVA_PREFIX, hva->irq_its);
   352			goto err_clk;
   353		}
   354		disable_irq(hva->irq_its);
   355	
   356		/* get error interruption resource */
   357		ret = platform_get_irq(pdev, 1);
   358		if (ret < 0)
   359			goto err_clk;
   360		hva->irq_err = ret;
   361	
   362		ret = devm_request_threaded_irq(dev, hva->irq_err, hva_hw_err_interrupt,
   363						hva_hw_err_irq_thread,
   364						IRQF_ONESHOT,
   365						"hva_err_irq", hva);
   366		if (ret) {
   367			dev_err(dev, "%s     failed to install error IRQ 0x%x\n",
   368				HVA_PREFIX, hva->irq_err);
   369			goto err_clk;
   370		}
   371		disable_irq(hva->irq_err);
   372	
   373		/* initialise protection mutex */
   374		mutex_init(&hva->protect_mutex);
   375	
   376		/* initialise completion signal */
   377		init_completion(&hva->interrupt);
   378	
   379		/* initialise runtime power management */
   380		pm_runtime_set_autosuspend_delay(dev, AUTOSUSPEND_DELAY_MS);
   381		pm_runtime_use_autosuspend(dev);
   382		pm_runtime_set_suspended(dev);
   383		pm_runtime_enable(dev);
   384	
   385		ret = pm_runtime_resume_and_get(dev);
   386		if (ret < 0) {
   387			dev_err(dev, "%s     failed to set PM\n", HVA_PREFIX);
   388			goto err_disable;
   389		}
   390	
   391		/* check IP hardware version */
   392		hva->ip_version = hva_hw_get_ip_version(hva);
   393	
   394		if (hva->ip_version == HVA_VERSION_UNKNOWN) {
   395			ret = -EINVAL;
   396			goto err_pm;
   397		}
   398	
   399		dev_info(dev, "%s     found hva device (version 0x%lx)\n", HVA_PREFIX,
   400			 hva->ip_version);
   401	
   402		return 0;
   403	
   404	err_pm:
   405		pm_runtime_put(dev);
   406	err_disable:
   407		pm_runtime_disable(dev);
   408	err_clk:
   409		if (hva->clk)
   410			clk_unprepare(hva->clk);
 > 411	disable_pm_runtime:
   412		pm_runtime_disable(dev);
   413		return ret;
   414	}
   415	

---
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-06  0:00 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:31 [PATCH] media: st-hva: Fix PM disable depth imbalance in hva_hw_probe Miaoqian Lin
2022-01-05 23:59 ` kernel test robot
2022-01-05 23:59   ` 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.