From: Cong Nguyen <congnt264@gmail.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Dave Stevenson <dave.stevenson@raspberrypi.com>,
Jacopo Mondi <jacopo@jmondi.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>,
Ramiro Oliveira <Ramiro.Oliveira@synopsys.com>,
Hans Verkuil <hverkuil@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] media: i2c: ov5647: fix power leak on remove while runtime-active
Date: Mon, 28 Sep 2026 21:12:32 +0700 [thread overview]
Message-ID: <20260928141232.2443546-1-congnt264@gmail.com> (raw)
ov5647_remove() calls pm_runtime_disable() and nothing else -- it
never calls ov5647_power_off(), which actually powers the sensor down
(disables the imaging clock, asserts the powerdown gpio, disables the
bulk regulators). pm_runtime_disable() only blocks future auto
suspend/resume, it doesn't force a final one.
If unbound while the device is genuinely runtime-active (streaming,
or an open subdev fd holding a PM reference), the clock, gpio and
regulators stay in their active state with no code path left to ever
release them.
Call ov5647_power_off() in that case, guarded by
pm_runtime_status_suspended() so the common already-suspended case
isn't suspended twice -- same guard sibling imx412.c's remove() uses.
Fixes: 3c2472a3c548 ("[media] media: i2c: Add support for OV5647 sensor")
Assisted-by: LLM
Signed-off-by: Cong Nguyen <congnt264@gmail.com>
---
drivers/media/i2c/ov5647.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c
index 3facf92b3841..52124327959a 100644
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -1271,6 +1271,8 @@ static void ov5647_remove(struct i2c_client *client)
v4l2_ctrl_handler_free(&sensor->ctrls);
v4l2_device_unregister_subdev(sd);
pm_runtime_disable(&client->dev);
+ if (!pm_runtime_status_suspended(&client->dev))
+ ov5647_power_off(&client->dev);
}
static const struct dev_pm_ops ov5647_pm_ops = {
--
2.25.1
reply other threads:[~2026-09-28 14:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260928141232.2443546-1-congnt264@gmail.com \
--to=congnt264@gmail.com \
--cc=Ramiro.Oliveira@synopsys.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=hverkuil@kernel.org \
--cc=jacopo@jmondi.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=vladimir_zapolskiy@mentor.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®