]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
pmdomain: mediatek: fix remaining %pOF after of_node_put()
authorGuangshuo Li <lgs201920130244@gmail.com>
Wed, 8 Jul 2026 09:20:38 +0000 (17:20 +0800)
committerUlf Hansson <ulfh@kernel.org>
Mon, 27 Jul 2026 09:46:33 +0000 (11:46 +0200)
commit3e013bc8b941bd52c8e3a99798d0ae8792cb71ca
tree464b9cff252c31553f889387365dbc4d51db7df7
parentcbb0140379de69fa46526672f3003f128f0b4e2e
pmdomain: mediatek: fix remaining %pOF after of_node_put()

scpsys_get_bus_protection_legacy() looks up several legacy bus
protection regmaps from device-tree nodes.

Two error paths put the device node before checking whether the regmap
lookup failed, but still pass that node to dev_err_probe() with %pOF on
failure. If of_node_put() drops the last reference, the later %pOF
formatting can dereference a freed device node.

Keep the node reference until after the error message has been emitted in
the infracfg and SMI lookup paths. Also drop the SMI node before
returning when the SMI phandle is missing.

Fixes: c29345fa5f66 ("pmdomain: mediatek: Refactor bus protection regmaps retrieval")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
drivers/pmdomain/mediatek/mtk-pm-domains.c