summaryrefslogtreecommitdiff
path: root/shared-core/nouveau_state.c
diff options
context:
space:
mode:
authorMaarten Maathuis <madman2003@gmail.com>2007-10-01 22:21:23 +0200
committerMaarten Maathuis <madman2003@gmail.com>2007-10-01 22:21:23 +0200
commit69fcfb413e72ad2204d306f20af6547819e040da (patch)
tree94442a44b2bb08cc4fdd773db7a26ce84766e34e /shared-core/nouveau_state.c
parente1600646a90f11c7a5874c83bda6f70f789f7f48 (diff)
nouveau: Fix dereferencing a NULL pointer when erroring out during initialization.
Diffstat (limited to 'shared-core/nouveau_state.c')
-rw-r--r--shared-core/nouveau_state.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/shared-core/nouveau_state.c b/shared-core/nouveau_state.c
index cba12b57..cb19c880 100644
--- a/shared-core/nouveau_state.c
+++ b/shared-core/nouveau_state.c
@@ -423,12 +423,15 @@ void nouveau_lastclose(struct drm_device *dev)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
- nouveau_card_takedown(dev);
-
- if(dev_priv->fb_mtrr>0)
- {
- drm_mtrr_del(dev_priv->fb_mtrr, drm_get_resource_start(dev, 1),nouveau_mem_fb_amount(dev), DRM_MTRR_WC);
- dev_priv->fb_mtrr=0;
+ /* In the case of an error dev_priv may not be be allocated yet */
+ if (dev_priv && dev_priv->card_type) {
+ nouveau_card_takedown(dev);
+
+ if(dev_priv->fb_mtrr>0)
+ {
+ drm_mtrr_del(dev_priv->fb_mtrr, drm_get_resource_start(dev, 1),nouveau_mem_fb_amount(dev), DRM_MTRR_WC);
+ dev_priv->fb_mtrr=0;
+ }
}
}