nouveau: handle early initialization errors
authorMarcin Slusarz <marcin.slusarz@gmail.com>
Mon, 23 Aug 2010 20:40:58 +0000 (22:40 +0200)
committerFrancisco Jerez <currojerez@riseup.net>
Wed, 25 Aug 2010 22:28:01 +0000 (00:28 +0200)
handle very early errors in pipe_screen creation (failure of
nouveau_screen_init in nv50_screen_create)

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
src/gallium/drivers/nouveau/nouveau_screen.c
src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c

index 513e5e02bc05ab834b0f0c48d05532d978b752b0..ebb21a6e5a37d53b5c817c86cb24f38001453e12 100644 (file)
@@ -258,6 +258,7 @@ nouveau_screen_fini(struct nouveau_screen *screen)
 {
        struct pipe_winsys *ws = screen->base.winsys;
        nouveau_channel_free(&screen->channel);
-       ws->destroy(ws);
+       if (ws)
+               ws->destroy(ws);
 }
 
index 660dbd0c332e99244088bc2b1e596a847740bd6c..d4bf124ce6f2c28ae43831098b2298734cdb0d48 100644 (file)
@@ -19,7 +19,8 @@ nouveau_drm_destroy_winsys(struct pipe_winsys *s)
 {
        struct nouveau_winsys *nv_winsys = nouveau_winsys(s);
        struct nouveau_screen *nv_screen= nouveau_screen(nv_winsys->pscreen);
-       nouveau_device_close(&nv_screen->device);
+       if (nv_screen)
+               nouveau_device_close(&nv_screen->device);
        FREE(nv_winsys);
 }