Skip to contentSkip to conversation

ov7251: Fix multiple problems in s_stream callback

PATCH In review Sakari Ailus 2 participants 2 messages May 18, 2022 – Jun 2, 2022

Subsystems (2)
lore
Share & tools
lore

Sakari Ailus

author maintainer
#0 lore raw

PATCH v2 1/1 ov7251: Fix multiple problems in s_stream callback

The s_stream callback had several issues:

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

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

Fix this.

Fixes ("media: i2c: Add pm_runtime support to ov7251")
---
 drivers/media/i2c/ov7251.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/media/i2c/ov7251.c +2 -3
index 0e7be15bc20a7..603a4c7049e69 100644
@@ -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,11 @@ 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;
 }
Signature · 1 line
2.30.2
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · Sakari Ailus

The s_stream callback had several issues:

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

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

Fix this.

Perhaps late, but nevertheless

Quoted 36 lines
Fixes ("media: i2c: Add pm_runtime support to ov7251")
---
 drivers/media/i2c/ov7251.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/media/i2c/ov7251.c +2 -3
index 0e7be15bc20a7..603a4c7049e69 100644
@@ -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,11 @@ 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;
 }
Signature · 1 line
2.30.2
Signature · 2 lines
With Best Regards,
Andy Shevchenko