diff mbox series

[76/78] media: sun4i_v4l2: use pm_runtime_resume_and_get()

Message ID 19ff6114784154d1ce289b01bd22230a37b77a98.1619191723.git.mchehab+huawei@kernel.org (mailing list archive)
State New, archived
Headers show
Series [01/78] media: atmel: properly get pm_runtime | expand

Commit Message

Mauro Carvalho Chehab April 24, 2021, 6:45 a.m. UTC
Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter")
added pm_runtime_resume_and_get() in order to automatically handle
dev->power.usage_count decrement on errors.

Use the new API, in order to cleanup the error check logic.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

kernel test robot April 24, 2021, 10:21 a.m. UTC | #1
Hi Mauro,

I love your patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on next-20210423]
[cannot apply to rockchip/for-next tegra/for-next v5.12-rc8]
[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/Mauro-Carvalho-Chehab/media-use-pm_runtime_resume_and_get-instead-of-pm_runtime_get_sync/20210424-145029
base:   git://linuxtv.org/media_tree.git master
config: nios2-randconfig-s031-20210424 (attached as .config)
compiler: nios2-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/ddf22a45db8814ab855d3535a125e17f5e58f94b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Mauro-Carvalho-Chehab/media-use-pm_runtime_resume_and_get-instead-of-pm_runtime_get_sync/20210424-145029
        git checkout ddf22a45db8814ab855d3535a125e17f5e58f94b
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=nios2 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c: In function 'sun4i_csi_open':
>> drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c:215:3: error: label 'err_pm_put' used but not defined
     215 |   goto err_pm_put;
         |   ^~~~

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for SERIAL_CORE_CONSOLE
   Depends on TTY && HAS_IOMEM
   Selected by
   - EARLY_PRINTK


vim +/err_pm_put +215 drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c

577bbf23b758848 Maxime Ripard         2019-08-22  199  
577bbf23b758848 Maxime Ripard         2019-08-22  200  static int sun4i_csi_open(struct file *file)
577bbf23b758848 Maxime Ripard         2019-08-22  201  {
577bbf23b758848 Maxime Ripard         2019-08-22  202  	struct sun4i_csi *csi = video_drvdata(file);
577bbf23b758848 Maxime Ripard         2019-08-22  203  	int ret;
577bbf23b758848 Maxime Ripard         2019-08-22  204  
577bbf23b758848 Maxime Ripard         2019-08-22  205  	ret = mutex_lock_interruptible(&csi->lock);
577bbf23b758848 Maxime Ripard         2019-08-22  206  	if (ret)
577bbf23b758848 Maxime Ripard         2019-08-22  207  		return ret;
577bbf23b758848 Maxime Ripard         2019-08-22  208  
ddf22a45db8814a Mauro Carvalho Chehab 2021-04-24  209  	ret = pm_runtime_resume_and_get(csi->dev);
577bbf23b758848 Maxime Ripard         2019-08-22  210  	if (ret < 0)
ddf22a45db8814a Mauro Carvalho Chehab 2021-04-24  211  		goto err_unlock;
577bbf23b758848 Maxime Ripard         2019-08-22  212  
8fd390b89cc8ca7 Ezequiel Garcia       2020-01-24  213  	ret = v4l2_pipeline_pm_get(&csi->vdev.entity);
577bbf23b758848 Maxime Ripard         2019-08-22  214  	if (ret)
577bbf23b758848 Maxime Ripard         2019-08-22 @215  		goto err_pm_put;
577bbf23b758848 Maxime Ripard         2019-08-22  216  
577bbf23b758848 Maxime Ripard         2019-08-22  217  	ret = v4l2_fh_open(file);
577bbf23b758848 Maxime Ripard         2019-08-22  218  	if (ret)
577bbf23b758848 Maxime Ripard         2019-08-22  219  		goto err_pipeline_pm_put;
577bbf23b758848 Maxime Ripard         2019-08-22  220  
577bbf23b758848 Maxime Ripard         2019-08-22  221  	mutex_unlock(&csi->lock);
577bbf23b758848 Maxime Ripard         2019-08-22  222  
577bbf23b758848 Maxime Ripard         2019-08-22  223  	return 0;
577bbf23b758848 Maxime Ripard         2019-08-22  224  
577bbf23b758848 Maxime Ripard         2019-08-22  225  err_pipeline_pm_put:
8fd390b89cc8ca7 Ezequiel Garcia       2020-01-24  226  	v4l2_pipeline_pm_put(&csi->vdev.entity);
577bbf23b758848 Maxime Ripard         2019-08-22  227  
ddf22a45db8814a Mauro Carvalho Chehab 2021-04-24  228  err_unlock:
577bbf23b758848 Maxime Ripard         2019-08-22  229  	mutex_unlock(&csi->lock);
577bbf23b758848 Maxime Ripard         2019-08-22  230  
577bbf23b758848 Maxime Ripard         2019-08-22  231  	return ret;
577bbf23b758848 Maxime Ripard         2019-08-22  232  }
577bbf23b758848 Maxime Ripard         2019-08-22  233  

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

Patch

diff --git a/drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c b/drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c
index 4785faddf630..ed6ec41b9c2d 100644
--- a/drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c
+++ b/drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c
@@ -206,9 +206,9 @@  static int sun4i_csi_open(struct file *file)
 	if (ret)
 		return ret;
 
-	ret = pm_runtime_get_sync(csi->dev);
+	ret = pm_runtime_resume_and_get(csi->dev);
 	if (ret < 0)
-		goto err_pm_put;
+		goto err_unlock;
 
 	ret = v4l2_pipeline_pm_get(&csi->vdev.entity);
 	if (ret)
@@ -225,8 +225,7 @@  static int sun4i_csi_open(struct file *file)
 err_pipeline_pm_put:
 	v4l2_pipeline_pm_put(&csi->vdev.entity);
 
-err_pm_put:
-	pm_runtime_put(csi->dev);
+err_unlock:
 	mutex_unlock(&csi->lock);
 
 	return ret;