[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221031232202.131945-9-prabhakar.mahadev-lad.rj@bp.renesas.com>
Date: Mon, 31 Oct 2022 23:22:01 +0000
From: Prabhakar <prabhakar.csengg@...il.com>
To: Sakari Ailus <sakari.ailus@...ux.intel.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
NXP Linux Team <linux-imx@....com>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Magnus Damm <magnus.damm@...il.com>,
Hans Verkuil <hverkuil@...all.nl>
Cc: Shawn Tu <shawnx.tu@...el.com>, Jacopo Mondi <jacopo@...ndi.org>,
linux-media@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-renesas-soc@...r.kernel.org,
Prabhakar <prabhakar.csengg@...il.com>,
Biju Das <biju.das.jz@...renesas.com>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
Subject: [PATCH v4 8/9] media: i2c: ov5645: Make sure to call PM functions
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
Make sure we call the PM functions while s_stream(0) even in case of
errors in the code flow.
v4l2-core takes care of warning the user so no need to add a warning
message in the driver.
Suggested-by: Sakari Ailus <sakari.ailus@...ux.intel.com>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
---
v3->v4
* Fixed comments pointed by Marco
v2->v3
* Now propagating the first error code in case of failure.
v1->v2
* New patch
---
drivers/media/i2c/ov5645.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c
index 6897f542737a..0a889283da36 100644
--- a/drivers/media/i2c/ov5645.c
+++ b/drivers/media/i2c/ov5645.c
@@ -998,15 +998,12 @@ static int ov5645_s_stream(struct v4l2_subdev *subdev, int enable)
} else {
ret = ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x40);
if (ret < 0)
- return ret;
+ goto stream_off_rpm_put;
ret = ov5645_write_reg(ov5645, OV5645_SYSTEM_CTRL0,
OV5645_SYSTEM_CTRL0_STOP);
- if (ret < 0)
- return ret;
- pm_runtime_mark_last_busy(ov5645->dev);
- pm_runtime_put_autosuspend(ov5645->dev);
+ goto stream_off_rpm_put;
}
return 0;
@@ -1014,6 +1011,11 @@ static int ov5645_s_stream(struct v4l2_subdev *subdev, int enable)
err_rpm_put:
pm_runtime_put_sync(ov5645->dev);
return ret;
+
+stream_off_rpm_put:
+ pm_runtime_mark_last_busy(ov5645->dev);
+ pm_runtime_put_autosuspend(ov5645->dev);
+ return ret;
}
static const struct v4l2_subdev_video_ops ov5645_video_ops = {
--
2.25.1
Powered by blists - more mailing lists