[PATCH 1/1] drm/msm/mdp4: avoid possible null pointer dereference

From: Heinrich Schuchardt
Date: Wed May 18 2016 - 17:06:35 EST


Do not dereference pll_rate before checking if it is NULL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@xxxxxx>
---
drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_pll.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_pll.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_pll.c
index ce42459..bd10ffe 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_pll.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_pll.c
@@ -72,11 +72,11 @@ static int mpd4_lvds_pll_enable(struct clk_hw *hw)
const struct pll_rate *pll_rate = find_rate(lvds_pll->pixclk);
int i;

- DBG("pixclk=%lu (%lu)", lvds_pll->pixclk, pll_rate->rate);
-
if (WARN_ON(!pll_rate))
return -EINVAL;

+ DBG("pixclk=%lu (%lu)", lvds_pll->pixclk, pll_rate->rate);
+
mdp4_write(mdp4_kms, REG_MDP4_LCDC_LVDS_PHY_RESET, 0x33);

for (i = 0; pll_rate->conf[i].reg; i++)
--
2.1.4