Skip to contentSkip to conversation

drm/msm: dsi: dev_pm_opp_put_clkname() only when an opp_table exists

PATCH In review Rajendra Nayak 2 participants 2 messages Jul 20, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/msm: dsi: dev_pm_opp_put_clkname() only when an opp_table exists

Its possible for msm_dsi_host_init() to fail early, before dev_pm_opp_set_clkname() is called. In such cases, unconditionally calling dev_pm_opp_put_clkname() in msm_dsi_host_destroy() results in a crash. Put an additional check so that dev_pm_opp_put_clkname() is called only when an opp_table exists.

Fixes f99131fa7a23 ("drm/msm: dsi: Use OPP API to set clk/perf state")
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +2 -1
index 0a14c4a..4f580f7 100644
@@ -1936,7 +1936,8 @@ void msm_dsi_host_destroy(struct mipi_dsi_host *host)
 
 	if (msm_host->has_opp_table)
 		dev_pm_opp_of_remove_table(&msm_host->pdev->dev);
-	dev_pm_opp_put_clkname(msm_host->opp_table);
+	if (msm_host->opp_table)
+		dev_pm_opp_put_clkname(msm_host->opp_table);
 	pm_runtime_disable(&msm_host->pdev->dev);
 }
 
Signature · 7 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Tested-by on v1 1/1
#1 lore raw
Quoted 19 lines · Rajendra Nayak

Its possible for msm_dsi_host_init() to fail early, before dev_pm_opp_set_clkname() is called. In such cases, unconditionally calling dev_pm_opp_put_clkname() in msm_dsi_host_destroy() results in a crash. Put an additional check so that dev_pm_opp_put_clkname() is called only when an opp_table exists.

Fixes f99131fa7a23 ("drm/msm: dsi: Use OPP API to set clk/perf state")
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
index 0a14c4a..4f580f7 100644

drivers/gpu/drm/msm/dsi/dsi_host.c void msm_dsi_host_destroy(struct mipi_dsi_host · line 1943

Quoted 9 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2 -1
@@ -1936,7 +1936,8 @@ void msm_dsi_host_destroy(struct mipi_dsi_host 
 *host)
 
 	if (msm_host->has_opp_table)
 		dev_pm_opp_of_remove_table(&msm_host->pdev->dev);
-	dev_pm_opp_put_clkname(msm_host->opp_table);
+	if (msm_host->opp_table)
+		dev_pm_opp_put_clkname(msm_host->opp_table);
 	pm_runtime_disable(&msm_host->pdev->dev);
 }
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation