Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f0efc831 authored by Lloyd Atkinson's avatar Lloyd Atkinson Committed by Rob Clark
Browse files

drm/msm/dsi: check for failure on retrieving pll in dsi manager



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: default avatarLloyd Atkinson <latkinso@codeaurora.org>
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent 933519a5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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;
+3 −3
Original line number Diff line number Diff line
@@ -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);

+1 −1
Original line number Diff line number Diff line
@@ -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;