linux/drivers/pmdomain/mediatek
AngeloGioacchino Del Regno a4876f11aa pmdomain: mediatek: Fix possible nullptr KP in HWV cleanup/on-check
Should probe fail for HW_VOTER type power domains, this driver was
unconditionally trying to perform cleanup for DIRECT_CTL domains,
but only after checking if the target domain is powered on... with
the DIRECT_CTL scpsys_domain_is_on() code again.

And there's more: the scpsys_domain_is_on() function is also being
unconditionally used in the probe path, for any power domain that
has flag MTK_SCPD_KEEP_DEFAULT_OFF!

This bug was never experienced by anyone because the HWV domains
never failed probe, and because none of those is declared with the
aforementioned flag - but it's still something critical.

In order to fix this, add a check for MTCMOS Type and, based on
that, call the correct functions for an "is on" check, and also
do the same for the cleanup path, calling the correct functions
for the "power off" action.

For the latter, since there's a call to pm_genpd_remove() right
before calling power_off, be cautious and add a variation of the
power off functions (with a _internal suffix) for those to get a
pointer to scpsys_domain instead of one to generic_pm_domain as,
even if that's still working, this is way too much fragile and
would break at some point.

Fixes: 88914db077 ("pmdomain: mediatek: Add support for Hardware Voter power domains")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
2026-07-13 12:42:17 +02:00
..
airoha-cpu-pmdomain.c pmdomain: mediatek: airoha: convert from round_rate() to determine_rate() 2025-09-17 16:28:18 +02:00
Kconfig pmdomain: mediatek: mtk-mfg: select MAILBOX in Kconfig 2025-11-19 18:06:50 +01:00
Makefile pmdomain: mediatek: Add support for MFlexGraphics 2025-11-19 18:06:50 +01:00
mt6735-pm-domains.h pmdomain: mediatek: Add support for MT6735 2024-10-22 13:08:11 +02:00
mt6795-pm-domains.h pmdomain: mediatek: Convert all SoCs to new style regmap retrieval 2025-08-19 14:12:41 +02:00
mt6893-pm-domains.h pmdomain: mediatek: Add support for Dimensity 1200 MT6893 2025-04-23 10:28:13 +02:00
mt8167-pm-domains.h pmdomain: mediatek: Convert all SoCs to new style regmap retrieval 2025-08-19 14:12:41 +02:00
mt8173-pm-domains.h pmdomain: mediatek: Convert all SoCs to new style regmap retrieval 2025-08-19 14:12:41 +02:00
mt8183-pm-domains.h pmdomain: mediatek: Convert all SoCs to new style regmap retrieval 2025-08-19 14:12:41 +02:00
mt8186-pm-domains.h pmdomain: mediatek: Convert all SoCs to new style regmap retrieval 2025-08-19 14:12:41 +02:00
mt8188-pm-domains.h pmdomain: mediatek: Convert all SoCs to new style regmap retrieval 2025-08-19 14:12:41 +02:00
mt8189-pm-domains.h pmdomain: mediatek: Add power domain driver for MT8189 SoC 2026-04-01 13:07:31 +02:00
mt8192-pm-domains.h pmdomain: mediatek: Convert all SoCs to new style regmap retrieval 2025-08-19 14:12:41 +02:00
mt8195-pm-domains.h pmdomain: Merge branch fixes into next 2025-09-23 16:35:23 +02:00
mt8196-pm-domains.h pmdomain: mediatek: Add support for MT8196 HFRPSYS power domains 2025-11-19 18:06:50 +01:00
mt8365-pm-domains.h pmdomain: mediatek: Convert all SoCs to new style regmap retrieval 2025-08-19 14:12:41 +02:00
mtk-mfg-pmdomain.c pmdomain: mediatek: mfg: move __packed after struct name to fix kernel-doc 2026-06-03 12:04:31 +02:00
mtk-pm-domains.c pmdomain: mediatek: Fix possible nullptr KP in HWV cleanup/on-check 2026-07-13 12:42:17 +02:00
mtk-pm-domains.h pmdomain: mediatek: Add bus protect control flow for MT8189 2026-04-01 13:07:31 +02:00
mtk-scpsys.c pmdomain: mediatek: scpsys: Add MT7622 Audio power domain to legacy driver 2026-04-01 13:07:31 +02:00