nouveau: Fix dereferencing a NULL pointer when erroring out during initialization.

main
Maarten Maathuis 2007-10-01 22:21:23 +02:00
parent e1600646a9
commit 69fcfb413e
1 changed files with 8 additions and 5 deletions

View File

@ -423,12 +423,15 @@ void nouveau_lastclose(struct drm_device *dev)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
nouveau_card_takedown(dev);
/* 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;
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;
}
}
}