Skip to content

Commit

Permalink
drm/msm/dsi: check for failure on retrieving pll in dsi manager
Browse files Browse the repository at this point in the history
Make msm_dsi_pll_init consistently return an error code instead
of NULL when pll initialization fails so that later pll
retrieval can check against an error code. Add checks for these
failures after retrieval of src_pll to avoid invalid pointer
dereferences later in msm_dsi_pll_get_clk_provider.

Signed-off-by: Lloyd Atkinson <latkinso@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
  • Loading branch information
Lloyd Atkinson authored and Rob Clark committed Feb 20, 2018
1 parent 933519a commit f0efc83
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions drivers/gpu/drm/msm/dsi/dsi_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ static int dsi_mgr_setup_components(int id)

msm_dsi_phy_set_usecase(msm_dsi->phy, MSM_DSI_PHY_STANDALONE);
src_pll = msm_dsi_phy_get_pll(msm_dsi->phy);
if (IS_ERR(src_pll))
return PTR_ERR(src_pll);
ret = msm_dsi_host_set_src_pll(msm_dsi->host, src_pll);
} else if (!other_dsi) {
ret = 0;
Expand Down Expand Up @@ -116,6 +118,8 @@ static int dsi_mgr_setup_components(int id)
msm_dsi_phy_set_usecase(clk_slave_dsi->phy,
MSM_DSI_PHY_SLAVE);
src_pll = msm_dsi_phy_get_pll(clk_master_dsi->phy);
if (IS_ERR(src_pll))
return PTR_ERR(src_pll);
ret = msm_dsi_host_set_src_pll(msm_dsi->host, src_pll);
if (ret)
return ret;
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,10 @@ static int dsi_phy_driver_probe(struct platform_device *pdev)
goto fail;

phy->pll = msm_dsi_pll_init(pdev, phy->cfg->type, phy->id);
if (!phy->pll)
if (IS_ERR_OR_NULL(phy->pll))
dev_info(dev,
"%s: pll init failed, need separate pll clk driver\n",
__func__);
"%s: pll init failed: %ld, need separate pll clk driver\n",
__func__, PTR_ERR(phy->pll));

dsi_phy_disable_resource(phy);

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/msm/dsi/pll/dsi_pll.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ struct msm_dsi_pll *msm_dsi_pll_init(struct platform_device *pdev,

if (IS_ERR(pll)) {
dev_err(dev, "%s: failed to init DSI PLL\n", __func__);
return NULL;
return pll;
}

pll->type = type;
Expand Down

0 comments on commit f0efc83

Please sign in to comment.