[PATCH v4 2/2] staging: nvec: fix unconditional pm_power_off teardown
From: Alexandru Hossu
Date: Mon Apr 27 2026 - 04:23:41 EST
tegra_nvec_remove() unconditionally sets pm_power_off = NULL, even if
nvec was not the one that registered it. This breaks any other driver
that may have set pm_power_off to its own handler.
Replace the unconditional assignment with a guarded check so that
pm_power_off is only cleared if nvec was the one that set it.
Also remove the stale FIXME comment, as the guard addresses exactly
what it was asking for.
Reviewed-by: Dan Carpenter <error27@xxxxxxxxx>
Signed-off-by: Alexandru Hossu <hossu.alexandru@xxxxxxxxx>
---
drivers/staging/nvec/nvec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 2a3499dd4d63..88c416ee0381 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -906,8 +906,8 @@ 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;
+ if (pm_power_off == nvec_power_off)
+ pm_power_off = NULL;
}
#ifdef CONFIG_PM_SLEEP
--
2.53.0