drm/bridge: dw-mipi-dsi2: fail probe when runtime PM setup fails
Subsystems (3)
PATCH 1/1 drm/bridge: dw-mipi-dsi2: fail probe when runtime PM setup fails
devm_pm_runtime_enable() can fail after it has already rolled runtime PM back to the disabled state. __dw_mipi_dsi2_probe() ignored that error and could publish a MIPI DSI host whose mode-setting path then issues pm_runtime_get_sync() calls against a runtime-PM-disabled device.
Propagate the setup error before registering the host. Leave runtime PM cleanup to devres if host registration then fails, so runtime PM is not disabled twice.
Fixes 0d6d86253fef ("drm/bridge/synopsys: Add MIPI DSI2 host controller bridge")
Signed-off-by Jiawen Liu <[email protected]>
--- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c +4 -2
@@ -973,14 +973,16 @@ __dw_mipi_dsi2_probe(struct platform_device *pdev,clk_disable_unprepare (dsi2->pclk); } -devm_pm_runtime_enable (dev); + ret =devm_pm_runtime_enable (dev); +if (ret) +return dev_err_ptr_probe (dev, ret, +"Failed to enable runtime PM\n" ); dsi2->dsi_host.ops = &dw_mipi_dsi2_host_ops; dsi2->dsi_host.dev = dev; ret =mipi_dsi_host_register (&dsi2->dsi_host);if (ret) {dev_err (dev,"Failed to register MIPI host: %d\n" , ret); -pm_runtime_disable (dev);return ERR_PTR (ret); }
Signature · 1 line
2.34.1