drm/msm/phy/dsi_phy: Set pll to NULL in case initialization fails [Linux 5.3]

This Linux kernel change "drm/msm/phy/dsi_phy: Set pll to NULL in case initialization fails" is included in the Linux 5.3 release. This change is authored by Sean Paul <seanpaul [at] chromium.org> on Mon Jun 17 16:09:17 2019 -0400. The commit for this change in Linux stable tree is 7896e22 (patch).

drm/msm/phy/dsi_phy: Set pll to NULL in case initialization fails

We have if (!phy->pll) checks scattered through the driver and if
phy->pll is an error pointer, those checks will pass and bad things will
happen :(

Reviewed-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190617200920.133104-1-sean@poorly.run

There are 4 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
index fda7374..524d4c4 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
@@ -618,10 +618,12 @@ 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 (IS_ERR_OR_NULL(phy->pll))
+   if (IS_ERR_OR_NULL(phy->pll)) {
            "%s: pll init failed: %ld, need separate pll clk driver\n",
            __func__, PTR_ERR(phy->pll));
+       phy->pll = NULL;
+   }


Leave a Reply

Your email address will not be published. Required fields are marked *