]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
staging: nvec: fix unconditional pm_power_off teardown
authorAlexandru Hossu <hossu.alexandru@gmail.com>
Mon, 27 Apr 2026 08:17:13 +0000 (10:17 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 4 May 2026 14:17:10 +0000 (16:17 +0200)
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@gmail.com>
Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
Link: https://patch.msgid.link/20260427081713.3401874-3-hossu.alexandru@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/nvec/nvec.c

index 2a3499dd4d63422eb50b20373b7297076d972f6a..88c416ee0381de836e7ada84d79088cd981c3e82 100644 (file)
@@ -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