All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] ov7251: Fix multiple problems in s_stream callback
@ 2022-05-13  9:47 Sakari Ailus
  2022-05-13 14:14 ` Sakari Ailus
  0 siblings, 1 reply; 2+ messages in thread
From: Sakari Ailus @ 2022-05-13  9:47 UTC (permalink / raw)
  To: linux-media
  Cc: yong.zhi, sakari.ailus, bingbu.cao, tian.shu.qiu,
	andriy.shevchenko, hverkuil-cisco, Daniel Scally

The s_stream callback had several issues:

- If pm_runtime_get_sync() fails, the usage_count is not put.

- The mutex wasn't unlocked and the sensor wasn't suspended if
  s_stream(subdev, 1) failed.

Fixes: ("media: i2c: Add pm_runtime support to ov7251")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/i2c/ov7251.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c
index 4867dc86cd2e4..603a4c7049e69 100644
--- a/drivers/media/i2c/ov7251.c
+++ b/drivers/media/i2c/ov7251.c
@@ -1340,7 +1340,7 @@ static int ov7251_s_stream(struct v4l2_subdev *subdev, int enable)
 	if (enable) {
 		ret = pm_runtime_get_sync(ov7251->dev);
 		if (ret < 0)
-			goto unlock_out;
+			goto err_power_down;
 
 		ret = ov7251_pll_configure(ov7251);
 		if (ret) {
@@ -1372,12 +1372,12 @@ static int ov7251_s_stream(struct v4l2_subdev *subdev, int enable)
 		pm_runtime_put(ov7251->dev);
 	}
 
-unlock_out:
 	mutex_unlock(&ov7251->lock);
 	return ret;
 
 err_power_down:
-	pm_runtime_put_noidle(ov7251->dev);
+	pm_runtime_put(ov7251->dev);
+	mutex_unlock(&ov7251->lock);
 	return ret;
 }
 
-- 
2.30.2


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

* Re: [PATCH 1/1] ov7251: Fix multiple problems in s_stream callback
  2022-05-13  9:47 [PATCH 1/1] ov7251: Fix multiple problems in s_stream callback Sakari Ailus
@ 2022-05-13 14:14 ` Sakari Ailus
  0 siblings, 0 replies; 2+ messages in thread
From: Sakari Ailus @ 2022-05-13 14:14 UTC (permalink / raw)
  To: linux-media
  Cc: yong.zhi, bingbu.cao, tian.shu.qiu, andriy.shevchenko,
	hverkuil-cisco, Daniel Scally

On Fri, May 13, 2022 at 12:47:07PM +0300, Sakari Ailus wrote:
> The s_stream callback had several issues:
> 
> - If pm_runtime_get_sync() fails, the usage_count is not put.
> 
> - The mutex wasn't unlocked and the sensor wasn't suspended if
>   s_stream(subdev, 1) failed.
> 
> Fixes: ("media: i2c: Add pm_runtime support to ov7251")

I'm squashing this to the patch it fixes for the PR.

-- 
Sakari Ailus

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

end of thread, other threads:[~2022-05-13 14:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13  9:47 [PATCH 1/1] ov7251: Fix multiple problems in s_stream callback Sakari Ailus
2022-05-13 14:14 ` Sakari Ailus

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.