From: Wei Yongjun Date: Wed, 11 Sep 2013 14:09:02 +0000 (+0800) Subject: drm/msm: fix potential NULL pointer dereference X-Git-Tag: firefly_0821_release~176^2~5263^2^2~1 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=aea6a64c38725b6fb30738a31695ef81af3079c3;p=firefly-linux-kernel-4.4.55.git drm/msm: fix potential NULL pointer dereference The dereference to 'pdata' should be moved below the NULL test. Signed-off-by: Wei Yongjun --- diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index 7ddcfbebb1f2..3bab937965d1 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c @@ -29,13 +29,14 @@ static void bs_init(struct msm_gpu *gpu, struct platform_device *pdev) { struct drm_device *dev = gpu->dev; - struct kgsl_device_platform_data *pdata = pdev->dev.platform_data; + struct kgsl_device_platform_data *pdata; if (!pdev) { dev_err(dev->dev, "could not find dtv pdata\n"); return; } + pdata = pdev->dev.platform_data; if (pdata->bus_scale_table) { gpu->bsc = msm_bus_scale_register_client(pdata->bus_scale_table); DBG("bus scale client: %08x", gpu->bsc);