From: Dima Volkovsk <s0ldw3ll@gmail.com>
To: marvin24@gmx.de, gregkh@linuxfoundation.org,
ac100@lists.launchpad.net, linux-tegra@vger.kernel.org,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: Dima Volkovsk <s0ldw3ll@gmail.com>
Subject: [PATCH] Staging: nvec: Fix pm_power_off reset condition in tegra_nvec_remove
Date: Sun, 9 Feb 2025 21:16:48 +0100 [thread overview]
Message-ID: <20250209201752.66313-1-s0ldw3ll@gmail.com> (raw)
In the current implementation of tegra_nvec_remove, the pm_power_off handler
is set to NULL without checking if it is actually set to nvec_power_off. This
change ensures that pm_power_off is only reset if it was previously set to
nvec_power_off, preventing unintended side effects when removing the device.
Signed-off-by: Dima Volkovsk <s0ldw3ll@gmail.com>
---
drivers/staging/nvec/nvec.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 263774e6a78c..9057f061e927 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -903,8 +903,10 @@ static void tegra_nvec_remove(struct platform_device *pdev)
nvec_unregister_notifier(nvec, &nvec->nvec_status_notifier);
cancel_work_sync(&nvec->rx_work);
cancel_work_sync(&nvec->tx_work);
- /* FIXME: needs check whether nvec is responsible for power off */
- pm_power_off = NULL;
+
+ /* only reset pm_power_off if it's our handler */
+ if (pm_power_off = nvec_power_off)
+ pm_power_off = NULL;
}
#ifdef CONFIG_PM_SLEEP
--
2.48.1
next reply other threads:[~2025-02-09 20:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-09 20:16 Dima Volkovsk [this message]
2025-02-10 6:10 ` [PATCH] Staging: nvec: Fix pm_power_off reset condition in tegra_nvec_remove Greg KH
2025-02-10 12:31 ` kernel test robot
2025-02-10 14:08 ` kernel test robot
2025-02-12 7:33 ` Dan Carpenter
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=20250209201752.66313-1-s0ldw3ll@gmail.com \
--to=s0ldw3ll@gmail.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 \
/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