mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Balakrishnan Sambath <balakrishnan.s@microchip.com>
To: Marc Dietrich <marvin24@gmx.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Stephen Warren <swarren@nvidia.com>,
	"Prashant Gaikwad" <pgaikwad@nvidia.com>
Cc: <ac100@lists.launchpad.net>, <linux-tegra@vger.kernel.org>,
	<linux-staging@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	"Balakrishnan Sambath" <balakrishnan.s@microchip.com>
Subject: [PATCH] staging: nvec: disable i2c slave on remove
Date: Thu, 2 Jul 2026 16:06:06 +0530	[thread overview]
Message-ID: <20260702-contrib-nvec-clk-leak-v1-1-659bcbe74e56@microchip.com> (raw)

tegra_init_i2c_slave() runs from probe and enables the i2c controller
clock with clk_prepare_enable(), and enables the interrupt.
tegra_nvec_remove() removes the mfd devices, notifier and work queues
but never calls the matching nvec_disable_i2c_slave(), so the clock's
prepare/enable count is leaked on unbind and the controller clock is
left running with no user.

The leak is only reached on driver unbind, which is why it has gone
unnoticed in normal use.

Call nvec_disable_i2c_slave() on remove, the same teardown the suspend
path already does.

Fixes: 61c3b1971ad4 ("staging: nvec: add clk_prepare/clk_unprepare")
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
 drivers/staging/nvec/nvec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 88c416ee0381..3869c16ad3c8 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -908,6 +908,7 @@ static void tegra_nvec_remove(struct platform_device *pdev)
 	cancel_work_sync(&nvec->tx_work);
 	if (pm_power_off == nvec_power_off)
 		pm_power_off = NULL;
+	nvec_disable_i2c_slave(nvec);
 }
 
 #ifdef CONFIG_PM_SLEEP

---
base-commit: be5c93fa674f0fc3c8f359c2143abce6bbb422e6
change-id: 20260702-contrib-nvec-clk-leak-77d573a746a6

Best regards,
-- 
Balakrishnan Sambath <balakrishnan.s@microchip.com>


             reply	other threads:[~2026-07-02 10:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02 10:36 Balakrishnan Sambath [this message]
2026-07-02 21:13 ` kernel test robot

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=20260702-contrib-nvec-clk-leak-v1-1-659bcbe74e56@microchip.com \
    --to=balakrishnan.s@microchip.com \
    --cc=ac100@lists.launchpad.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linux-tegra@vger.kernel.org \
    --cc=marvin24@gmx.de \
    --cc=pgaikwad@nvidia.com \
    --cc=swarren@nvidia.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®