]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm/msm: fix potential NULL pointer dereference
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Wed, 11 Sep 2013 14:09:02 +0000 (22:09 +0800)
committerRob Clark <robdclark@gmail.com>
Thu, 12 Sep 2013 14:32:12 +0000 (10:32 -0400)
The dereference to 'pdata' should be moved below the NULL test.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
drivers/gpu/drm/msm/msm_gpu.c

index 7ddcfbebb1f2c07af30ae963b020b3295b2c291e..3bab937965d1f596405864676464fe6370bf87bd 100644 (file)
 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);