Commit 33f409df authored by Ben Skeggs's avatar Ben Skeggs

drm/nv50-nvc0: tidy evo init failure paths

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 961b6e68
...@@ -198,6 +198,14 @@ nv50_evo_channel_fini(struct nouveau_channel *evo) ...@@ -198,6 +198,14 @@ nv50_evo_channel_fini(struct nouveau_channel *evo)
} }
} }
static void
nv50_evo_destroy(struct drm_device *dev)
{
struct nv50_display *disp = nv50_display(dev);
nv50_evo_channel_del(&disp->master);
}
static int static int
nv50_evo_create(struct drm_device *dev) nv50_evo_create(struct drm_device *dev)
{ {
...@@ -223,85 +231,69 @@ nv50_evo_create(struct drm_device *dev) ...@@ -223,85 +231,69 @@ nv50_evo_create(struct drm_device *dev)
NVOBJ_FLAG_ZERO_ALLOC, &evo->ramin); NVOBJ_FLAG_ZERO_ALLOC, &evo->ramin);
if (ret) { if (ret) {
NV_ERROR(dev, "Error allocating EVO channel memory: %d\n", ret); NV_ERROR(dev, "Error allocating EVO channel memory: %d\n", ret);
nv50_evo_channel_del(&disp->master); goto err;
return ret;
} }
ret = drm_mm_init(&evo->ramin_heap, 0, 32768); ret = drm_mm_init(&evo->ramin_heap, 0, 32768);
if (ret) { if (ret) {
NV_ERROR(dev, "Error initialising EVO PRAMIN heap: %d\n", ret); NV_ERROR(dev, "Error initialising EVO PRAMIN heap: %d\n", ret);
nv50_evo_channel_del(&disp->master); goto err;
return ret;
} }
ret = nouveau_gpuobj_new(dev, evo, 4096, 16, 0, &ramht); ret = nouveau_gpuobj_new(dev, evo, 4096, 16, 0, &ramht);
if (ret) { if (ret) {
NV_ERROR(dev, "Unable to allocate EVO RAMHT: %d\n", ret); NV_ERROR(dev, "Unable to allocate EVO RAMHT: %d\n", ret);
nv50_evo_channel_del(&disp->master); goto err;
return ret;
} }
ret = nouveau_ramht_new(dev, ramht, &evo->ramht); ret = nouveau_ramht_new(dev, ramht, &evo->ramht);
nouveau_gpuobj_ref(NULL, &ramht); nouveau_gpuobj_ref(NULL, &ramht);
if (ret) { if (ret)
nv50_evo_channel_del(&disp->master); goto err;
return ret;
}
/* create some default objects for the scanout memtypes we support */ /* create some default objects for the scanout memtypes we support */
if (dev_priv->card_type >= NV_C0) { if (dev_priv->card_type >= NV_C0) {
ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB32, 0xfe, 0x19, ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB32, 0xfe, 0x19,
0, 0xffffffff, 0x00000000); 0, 0xffffffff, 0x00000000);
if (ret) { if (ret)
nv50_evo_channel_del(&disp->master); goto err;
return ret;
}
ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM, 0, 0x19, ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM, 0, 0x19,
0, dev_priv->vram_size, 0x00020000); 0, dev_priv->vram_size, 0x00020000);
if (ret) { if (ret)
nv50_evo_channel_del(&disp->master); goto err;
return ret;
}
ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM_LP, 0, 0x19, ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM_LP, 0, 0x19,
0, dev_priv->vram_size, 0x00000000); 0, dev_priv->vram_size, 0x00000000);
if (ret) { if (ret)
nv50_evo_channel_del(&disp->master); goto err;
return ret;
}
} else { } else {
ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB16, 0x70, 0x19, ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB16, 0x70, 0x19,
0, 0xffffffff, 0x00010000); 0, 0xffffffff, 0x00010000);
if (ret) { if (ret)
nv50_evo_channel_del(&disp->master); goto err;
return ret;
}
ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB32, 0x7a, 0x19, ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB32, 0x7a, 0x19,
0, 0xffffffff, 0x00010000); 0, 0xffffffff, 0x00010000);
if (ret) { if (ret)
nv50_evo_channel_del(&disp->master); goto err;
return ret;
}
ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM, 0, 0x19, ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM, 0, 0x19,
0, dev_priv->vram_size, 0x00010000); 0, dev_priv->vram_size, 0x00010000);
if (ret) { if (ret)
nv50_evo_channel_del(&disp->master); goto err;
return ret;
}
ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM_LP, 0, 0x19, ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM_LP, 0, 0x19,
0, dev_priv->vram_size, 0x00010000); 0, dev_priv->vram_size, 0x00010000);
if (ret) { if (ret)
nv50_evo_channel_del(&disp->master); goto err;
return ret;
}
} }
return 0; return 0;
err:
nv50_evo_destroy(dev);
return ret;
} }
int int
...@@ -324,8 +316,7 @@ nv50_evo_fini(struct drm_device *dev) ...@@ -324,8 +316,7 @@ nv50_evo_fini(struct drm_device *dev)
{ {
struct nv50_display *disp = nv50_display(dev); struct nv50_display *disp = nv50_display(dev);
if (disp->master) { if (disp->master)
nv50_evo_channel_fini(disp->master); nv50_evo_channel_fini(disp->master);
nv50_evo_channel_del(&disp->master); nv50_evo_destroy(dev);
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment