All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 02/78] media: marvel-ccic: fix some issues when getting pm_runtime
@ 2021-04-24 11:12 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-04-24 11:12 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
In-Reply-To: <93a8c81827fd7fdd4b50ba5c5f63387519559bf5.1619191723.git.mchehab+huawei@kernel.org>
References: <93a8c81827fd7fdd4b50ba5c5f63387519559bf5.1619191723.git.mchehab+huawei@kernel.org>
TO: Mauro Carvalho Chehab <mchehab@kernel.org>
CC: linux-media(a)vger.kernel.org
CC: linuxarm(a)huawei.com
CC: mauro.chehab(a)huawei.com
CC: Mauro Carvalho Chehab <mchehab@kernel.org>
CC: linux-media(a)vger.kernel.org
CC: "Gustavo A. R. Silva" <gustavoars@kernel.org>
CC: Allen Pais <allen.lkml@gmail.com>
CC: Chuhong Yuan <hslester96@gmail.com>
CC: Ezequiel Garcia <ezequiel@collabora.com>
CC: Hans Verkuil <hverkuil@xs4all.nl>
CC: Lubomir Rintel <lkundrak@v3.sk>

Hi Mauro,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on rockchip/for-next tegra/for-next v5.12-rc8 next-20210423]
[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
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago
config: i386-randconfig-c021-20210424 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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


cocci warnings: (new ones prefixed by >>)
>> drivers/media/platform/marvell-ccic/mcam-core.c:1619:3-9: preceding lock on line 1609

vim +1619 drivers/media/platform/marvell-ccic/mcam-core.c

abfa3df36c01a3 drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-06-11  1599  
abfa3df36c01a3 drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-06-11  1600  /* ---------------------------------------------------------------------- */
abfa3df36c01a3 drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-06-11  1601  /*
d43dae75cc1140 drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-07-08  1602   * Our various file operations.
abfa3df36c01a3 drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-06-11  1603   */
d43dae75cc1140 drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-07-08  1604  static int mcam_v4l_open(struct file *filp)
d43dae75cc1140 drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-07-08  1605  {
d43dae75cc1140 drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-07-08  1606  	struct mcam_camera *cam = video_drvdata(filp);
949bd4081ffe95 drivers/media/platform/marvell-ccic/mcam-core.c Hans Verkuil          2015-03-05  1607  	int ret;
abfa3df36c01a3 drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-06-11  1608  
d43dae75cc1140 drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-07-08 @1609  	mutex_lock(&cam->s_mutex);
949bd4081ffe95 drivers/media/platform/marvell-ccic/mcam-core.c Hans Verkuil          2015-03-05  1610  	ret = v4l2_fh_open(filp);
d43dae75cc1140 drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-07-08  1611  	if (ret)
d43dae75cc1140 drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-07-08  1612  		goto out;
949bd4081ffe95 drivers/media/platform/marvell-ccic/mcam-core.c Hans Verkuil          2015-03-05  1613  	if (v4l2_fh_is_singular_file(filp)) {
81a409bfd5517d drivers/media/platform/marvell-ccic/mcam-core.c Lubomir Rintel        2019-05-28  1614  		ret = sensor_call(cam, core, s_power, 1);
05fed81625bf75 drivers/media/platform/marvell-ccic/mcam-core.c Libin Yang            2013-07-03  1615  		if (ret)
05fed81625bf75 drivers/media/platform/marvell-ccic/mcam-core.c Libin Yang            2013-07-03  1616  			goto out;
52f5b74e58d396 drivers/media/platform/marvell-ccic/mcam-core.c Mauro Carvalho Chehab 2021-04-24  1617  		ret = pm_runtime_resume_and_get(cam->dev);
52f5b74e58d396 drivers/media/platform/marvell-ccic/mcam-core.c Mauro Carvalho Chehab 2021-04-24  1618  		if (ret < 0)
52f5b74e58d396 drivers/media/platform/marvell-ccic/mcam-core.c Mauro Carvalho Chehab 2021-04-24 @1619  			return ret;
d43dae75cc1140 drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-07-08  1620  		__mcam_cam_reset(cam);
d43dae75cc1140 drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-07-08  1621  		mcam_set_config_needed(cam, 1);
d43dae75cc1140 drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-07-08  1622  	}
d43dae75cc1140 drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-07-08  1623  out:
d43dae75cc1140 drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-07-08  1624  	mutex_unlock(&cam->s_mutex);
44fbcb10cf35e3 drivers/media/platform/marvell-ccic/mcam-core.c Hans Verkuil          2015-03-05  1625  	if (ret)
44fbcb10cf35e3 drivers/media/platform/marvell-ccic/mcam-core.c Hans Verkuil          2015-03-05  1626  		v4l2_fh_release(filp);
d43dae75cc1140 drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-07-08  1627  	return ret;
a9b36e850782db drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-06-20  1628  }
abfa3df36c01a3 drivers/media/video/marvell-ccic/mcam-core.c    Jonathan Corbet       2011-06-11  1629  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34188 bytes --]

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

* [PATCH 02/78] media: marvel-ccic: fix some issues when getting pm_runtime
  2021-04-24  6:44 [PATCH 00/78] media: use pm_runtime_resume_and_get() instead of pm_runtime_get_sync() Mauro Carvalho Chehab
@ 2021-04-24  6:44 ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 2+ messages in thread
From: Mauro Carvalho Chehab @ 2021-04-24  6:44 UTC (permalink / raw)
  Cc: linuxarm, mauro.chehab, Mauro Carvalho Chehab,
	Gustavo A. R. Silva, Allen Pais, Chuhong Yuan, Ezequiel Garcia,
	Hans Verkuil, Lubomir Rintel, Mauro Carvalho Chehab,
	Sakari Ailus, Vaibhav Gupta, linux-kernel, linux-media

Calling pm_runtime_get_sync() is bad, since even when it
returns an error, pm_runtime_put*() should be called.
So, use instead pm_runtime_resume_and_get().

While here, ensure that the error condition will be checked
during clock enable an media open() calls.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 drivers/media/platform/marvell-ccic/mcam-core.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c b/drivers/media/platform/marvell-ccic/mcam-core.c
index 141bf5d97a04..3c3a6592e0e6 100644
--- a/drivers/media/platform/marvell-ccic/mcam-core.c
+++ b/drivers/media/platform/marvell-ccic/mcam-core.c
@@ -918,6 +918,7 @@ static int mclk_enable(struct clk_hw *hw)
 	struct mcam_camera *cam = container_of(hw, struct mcam_camera, mclk_hw);
 	int mclk_src;
 	int mclk_div;
+	int ret;
 
 	/*
 	 * Clock the sensor appropriately.  Controller clock should
@@ -931,7 +932,9 @@ static int mclk_enable(struct clk_hw *hw)
 		mclk_div = 2;
 	}
 
-	pm_runtime_get_sync(cam->dev);
+	ret = pm_runtime_resume_and_get(cam->dev);
+	if (ret < 0)
+		return ret;
 	clk_enable(cam->clk[0]);
 	mcam_reg_write(cam, REG_CLKCTRL, (mclk_src << 29) | mclk_div);
 	mcam_ctlr_power_up(cam);
@@ -1611,7 +1614,9 @@ static int mcam_v4l_open(struct file *filp)
 		ret = sensor_call(cam, core, s_power, 1);
 		if (ret)
 			goto out;
-		pm_runtime_get_sync(cam->dev);
+		ret = pm_runtime_resume_and_get(cam->dev);
+		if (ret < 0)
+			return ret;
 		__mcam_cam_reset(cam);
 		mcam_set_config_needed(cam, 1);
 	}
-- 
2.30.2


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

end of thread, other threads:[~2021-04-24 11:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-24 11:12 [PATCH 02/78] media: marvel-ccic: fix some issues when getting pm_runtime kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2021-04-24  6:44 [PATCH 00/78] media: use pm_runtime_resume_and_get() instead of pm_runtime_get_sync() Mauro Carvalho Chehab
2021-04-24  6:44 ` [PATCH 02/78] media: marvel-ccic: fix some issues when getting pm_runtime Mauro Carvalho Chehab

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.