From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
To: Xiaolei Wang <xiaolei.wang@windriver.com>
Cc: sakari.ailus@linux.intel.com, tarang.raval@siliconsignals.io,
laurent.pinchart@ideasonboard.com,
dave.stevenson@raspberrypi.com, jacopo@jmondi.org,
mchehab@kernel.org, prabhakar.mahadev-lad.rj@bp.renesas.com,
hverkuil+cisco@kernel.org, johannes.goede@oss.qualcomm.com,
hverkuil-cisco@xs4all.nl, jai.luthra@ideasonboard.com,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: i2c: ov5647: Fix runtime PM refcount leak in s_ctrl
Date: Wed, 25 Feb 2026 11:27:37 +0100 [thread overview]
Message-ID: <aZ7Og9Uq9tCMLi2U@zed> (raw)
In-Reply-To: <20260225085621.1756643-1-xiaolei.wang@windriver.com>
Hello Xiaolei
On Wed, Feb 25, 2026 at 04:56:21PM +0800, Xiaolei Wang wrote:
> Three control cases (AUTOGAIN, EXPOSURE_AUTO, ANALOGUE_GAIN) directly
> return without calling pm_runtime_put(), causing runtime PM reference
> count leaks.
>
> Change these cases from 'return' to 'ret = ... break' pattern to ensure
> pm_runtime_put() is always called before function exit.
>
> Fixes: 4f66f36388d5 ("media: i2c: ov5647: Convert to CCI register access helpers")
> Cc: stable@vger.kernel.org
> Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Thanks
j
> ---
> drivers/media/i2c/ov5647.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c
> index 6a46ef7233ac..db9bd2892140 100644
> --- a/drivers/media/i2c/ov5647.c
> +++ b/drivers/media/i2c/ov5647.c
> @@ -967,21 +967,21 @@ static int ov5647_s_ctrl(struct v4l2_ctrl *ctrl)
> break;
> case V4L2_CID_AUTOGAIN:
> /* Non-zero turns on AGC by clearing bit 1.*/
> - return cci_update_bits(sensor->regmap, OV5647_REG_AEC_AGC, BIT(1),
> - ctrl->val ? 0 : BIT(1), NULL);
> + ret = cci_update_bits(sensor->regmap, OV5647_REG_AEC_AGC, BIT(1),
> + ctrl->val ? 0 : BIT(1), NULL);
> break;
> case V4L2_CID_EXPOSURE_AUTO:
> /*
> * Everything except V4L2_EXPOSURE_MANUAL turns on AEC by
> * clearing bit 0.
> */
> - return cci_update_bits(sensor->regmap, OV5647_REG_AEC_AGC, BIT(0),
> - ctrl->val == V4L2_EXPOSURE_MANUAL ? BIT(0) : 0, NULL);
> + ret = cci_update_bits(sensor->regmap, OV5647_REG_AEC_AGC, BIT(0),
> + ctrl->val == V4L2_EXPOSURE_MANUAL ? BIT(0) : 0, NULL);
> break;
> case V4L2_CID_ANALOGUE_GAIN:
> /* 10 bits of gain, 2 in the high register. */
> - return cci_write(sensor->regmap, OV5647_REG_GAIN,
> - ctrl->val & 0x3ff, NULL);
> + ret = cci_write(sensor->regmap, OV5647_REG_GAIN,
> + ctrl->val & 0x3ff, NULL);
> break;
> case V4L2_CID_EXPOSURE:
> /*
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-02-25 10:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 8:56 [PATCH] media: i2c: ov5647: Fix runtime PM refcount leak in s_ctrl Xiaolei Wang
2026-02-25 10:27 ` Jacopo Mondi [this message]
2026-02-28 8:23 ` Tarang Raval
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aZ7Og9Uq9tCMLi2U@zed \
--to=jacopo.mondi@ideasonboard.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=hverkuil+cisco@kernel.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=jacopo@jmondi.org \
--cc=jai.luthra@ideasonboard.com \
--cc=johannes.goede@oss.qualcomm.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=sakari.ailus@linux.intel.com \
--cc=tarang.raval@siliconsignals.io \
--cc=xiaolei.wang@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.