summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2011-02-01 10:59:07 +1000
committerBen Skeggs <bskeggs@redhat.com>2011-02-25 06:44:51 +1000
commit33f409df1ef4b1eba580a3c3f78a28aa4cd2ed0c (patch)
tree1922f81f1f45c52776fca0264fa34c3a7665e118 /drivers
parent961b6e686ec73cfd2721c4e13745a8fe43e04350 (diff)
drm/nv50-nvc0: tidy evo init failure paths
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/nouveau/nv50_evo.c75
1 files changed, 33 insertions, 42 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_evo.c b/drivers/gpu/drm/nouveau/nv50_evo.c
index d9c77d84f0f..9703f759b71 100644
--- a/drivers/gpu/drm/nouveau/nv50_evo.c
+++ b/drivers/gpu/drm/nouveau/nv50_evo.c
@@ -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
nv50_evo_create(struct drm_device *dev)
{
@@ -223,85 +231,69 @@ nv50_evo_create(struct drm_device *dev)
NVOBJ_FLAG_ZERO_ALLOC, &evo->ramin);
if (ret) {
NV_ERROR(dev, "Error allocating EVO channel memory: %d\n", ret);
- nv50_evo_channel_del(&disp->master);
- return ret;
+ goto err;
}
ret = drm_mm_init(&evo->ramin_heap, 0, 32768);
if (ret) {
NV_ERROR(dev, "Error initialising EVO PRAMIN heap: %d\n", ret);
- nv50_evo_channel_del(&disp->master);
- return ret;
+ goto err;
}
ret = nouveau_gpuobj_new(dev, evo, 4096, 16, 0, &ramht);
if (ret) {
NV_ERROR(dev, "Unable to allocate EVO RAMHT: %d\n", ret);
- nv50_evo_channel_del(&disp->master);
- return ret;
+ goto err;
}
ret = nouveau_ramht_new(dev, ramht, &evo->ramht);
nouveau_gpuobj_ref(NULL, &ramht);
- if (ret) {
- nv50_evo_channel_del(&disp->master);
- return ret;
- }
+ if (ret)
+ goto err;
/* create some default objects for the scanout memtypes we support */
if (dev_priv->card_type >= NV_C0) {
ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB32, 0xfe, 0x19,
0, 0xffffffff, 0x00000000);
- if (ret) {
- nv50_evo_channel_del(&disp->master);
- return ret;
- }
+ if (ret)
+ goto err;
ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM, 0, 0x19,
0, dev_priv->vram_size, 0x00020000);
- if (ret) {
- nv50_evo_channel_del(&disp->master);
- return ret;
- }
+ if (ret)
+ goto err;
ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM_LP, 0, 0x19,
0, dev_priv->vram_size, 0x00000000);
- if (ret) {
- nv50_evo_channel_del(&disp->master);
- return ret;
- }
+ if (ret)
+ goto err;
} else {
ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB16, 0x70, 0x19,
0, 0xffffffff, 0x00010000);
- if (ret) {
- nv50_evo_channel_del(&disp->master);
- return ret;
- }
-
+ if (ret)
+ goto err;
ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB32, 0x7a, 0x19,
0, 0xffffffff, 0x00010000);
- if (ret) {
- nv50_evo_channel_del(&disp->master);
- return ret;
- }
+ if (ret)
+ goto err;
ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM, 0, 0x19,
0, dev_priv->vram_size, 0x00010000);
- if (ret) {
- nv50_evo_channel_del(&disp->master);
- return ret;
- }
+ if (ret)
+ goto err;
ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM_LP, 0, 0x19,
0, dev_priv->vram_size, 0x00010000);
- if (ret) {
- nv50_evo_channel_del(&disp->master);
- return ret;
- }
+ if (ret)
+ goto err;
}
return 0;
+
+err:
+ nv50_evo_destroy(dev);
+ return ret;
}
int
@@ -324,8 +316,7 @@ nv50_evo_fini(struct drm_device *dev)
{
struct nv50_display *disp = nv50_display(dev);
- if (disp->master) {
+ if (disp->master)
nv50_evo_channel_fini(disp->master);
- nv50_evo_channel_del(&disp->master);
- }
+ nv50_evo_destroy(dev);
}