summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_dma.c
diff options
context:
space:
mode:
authorMika Kuoppala <mika.kuoppala@linux.intel.com>2012-11-12 14:20:19 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-11-29 11:43:51 +0100
commit4f1ba0f83a6d4abd055cf75af43954b38df8dcaf (patch)
treede6614f3f538e62d231205a440fcbf666aba2e5d /drivers/gpu/drm/i915/i915_dma.c
parentfc37381cc8ae2c24b8ece33659e69a0605ca074c (diff)
downloadlinux-stable-4f1ba0f83a6d4abd055cf75af43954b38df8dcaf.tar.gz
linux-stable-4f1ba0f83a6d4abd055cf75af43954b38df8dcaf.tar.bz2
linux-stable-4f1ba0f83a6d4abd055cf75af43954b38df8dcaf.zip
drm/i915: fix possible NULL dereference of dev_priv
Dereference dev_priv only after we know it is valid. Found with smatch. Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_dma.c')
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index a48e4910ea2c..4ea331b931fd 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1045,7 +1045,7 @@ static int i915_set_status_page(struct drm_device *dev, void *data,
{
drm_i915_private_t *dev_priv = dev->dev_private;
drm_i915_hws_addr_t *hws = data;
- struct intel_ring_buffer *ring = LP_RING(dev_priv);
+ struct intel_ring_buffer *ring;
if (drm_core_check_feature(dev, DRIVER_MODESET))
return -ENODEV;
@@ -1065,6 +1065,7 @@ static int i915_set_status_page(struct drm_device *dev, void *data,
DRM_DEBUG_DRIVER("set status page addr 0x%08x\n", (u32)hws->addr);
+ ring = LP_RING(dev_priv);
ring->status_page.gfx_addr = hws->addr & (0x1ffff<<12);
dev_priv->dri1.gfx_hws_cpu_addr =