Skip to content

Commit 6b2690d

Browse files
pgwipeoutstorulf
authored andcommitted
pmdomain: rockchip: fix rockchip_pd_power error handling
The calls rockchip_pd_power makes to rockchip_pmu_set_idle_request lack any return error handling, causing device drivers to incorrectly believe the hardware idle requests succeed when they may have failed. This leads to software possibly accessing hardware that is powered off and the subsequent SError panic that follows. Add error checking and return errors to the calling function to prevent such crashes. gst-launch-1.0 videotestsrc num-buffers=2000 ! v4l2jpegenc ! fakesink Setting pipeline to PAUSED ...er-x64 Pipeline is PREROLLING ... Redistribute latency... rockchip-pm-domain ff100000.syscon:power-controller: failed to get ack on domain 'hevc', val=0x98260 SError Interrupt on CPU2, code 0x00000000bf000002 -- SError Signed-off-by: Peter Geis <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sebastian Reichel <[email protected]> Link: https://lore.kernel.org/r/20250220-rk3588-gpu-pwr-domain-regulator-v6-5-a4f9c24e5b81@kernel.org Signed-off-by: Ulf Hansson <[email protected]>
1 parent edcef66 commit 6b2690d

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

drivers/pmdomain/rockchip/pm-domains.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -607,26 +607,29 @@ static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on)
607607
rockchip_pmu_save_qos(pd);
608608

609609
/* if powering down, idle request to NIU first */
610-
rockchip_pmu_set_idle_request(pd, true);
610+
ret = rockchip_pmu_set_idle_request(pd, true);
611+
if (ret < 0)
612+
goto out;
611613
}
612614

613615
ret = rockchip_do_pmu_set_power_domain(pd, power_on);
614-
if (ret < 0) {
615-
clk_bulk_disable(pd->num_clks, pd->clks);
616-
return ret;
617-
}
616+
if (ret < 0)
617+
goto out;
618618

619619
if (power_on) {
620620
/* if powering up, leave idle mode */
621-
rockchip_pmu_set_idle_request(pd, false);
621+
ret = rockchip_pmu_set_idle_request(pd, false);
622+
if (ret < 0)
623+
goto out;
622624

623625
rockchip_pmu_restore_qos(pd);
624626
}
625627

628+
out:
626629
rockchip_pmu_ungate_clk(pd, false);
627630
clk_bulk_disable(pd->num_clks, pd->clks);
628631

629-
return 0;
632+
return ret;
630633
}
631634

632635
static int rockchip_pd_power_on(struct generic_pm_domain *domain)

0 commit comments

Comments
 (0)