mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cong Nguyen <congnt264@gmail.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Arec Kao <arec.kao@intel.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] media: i2c: ov13b10: fix power leak on remove while runtime-active
Date: Mon, 28 Sep 2026 21:02:16 +0700	[thread overview]
Message-ID: <20260928140216.2396160-1-congnt264@gmail.com> (raw)

ov13b10_remove() calls pm_runtime_set_suspended(), but that's pure
bookkeeping -- it doesn't call ov13b10_suspend() (which actually
deasserts reset, disables the regulators, and disables/unprepares the
clock via ov13b10_power_off()).

If unbound while ov13b10_set_stream() is holding an outstanding PM
reference (removed while actively streaming), the device stays
genuinely active with regulators/clock enabled forever after.

Call ov13b10_suspend() 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: 7ee850546822 ("media: Add sensor driver support for the ov13b10 camera.")
Assisted-by: LLM
Signed-off-by: Cong Nguyen <congnt264@gmail.com>
---
 drivers/media/i2c/ov13b10.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/i2c/ov13b10.c b/drivers/media/i2c/ov13b10.c
index b0d34141a13a..ab5cf9af2e85 100644
--- a/drivers/media/i2c/ov13b10.c
+++ b/drivers/media/i2c/ov13b10.c
@@ -1688,6 +1688,8 @@ static void ov13b10_remove(struct i2c_client *client)
 	ov13b10_free_controls(ov13b);
 
 	pm_runtime_disable(ov13b->dev);
+	if (!pm_runtime_status_suspended(ov13b->dev))
+		ov13b10_suspend(ov13b->dev);
 	pm_runtime_set_suspended(ov13b->dev);
 }
 
-- 
2.25.1


                 reply	other threads:[~2026-09-28 14:02 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=20260928140216.2396160-1-congnt264@gmail.com \
    --to=congnt264@gmail.com \
    --cc=arec.kao@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.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®