[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPgLHd8h4kV4U0g9orq_dLzB67UXTYXLQR_5dscyrBd=q6VERw@mail.gmail.com>
Date: Wed, 11 Sep 2013 22:09:02 +0800
From: Wei Yongjun <weiyj.lk@...il.com>
To: airlied@...ux.ie, robdclark@...il.com
Cc: yongjun_wei@...ndmicro.com.cn, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] drm/msm: fix potential NULL pointer dereference
From: Wei Yongjun <yongjun_wei@...ndmicro.com.cn>
The dereference to 'pdata' should be moved below the NULL test.
Signed-off-by: Wei Yongjun <yongjun_wei@...ndmicro.com.cn>
---
drivers/gpu/drm/msm/msm_gpu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index e1e1ec9..6b50e6b 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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists