Browse files

Free desc buffer object only when a target chipset is NVE0

Since NVC0 chipset doesn't allocate it, this causes segv.
  • Loading branch information...
1 parent 5b835c2 commit f0e7e83afe35bf213754e361cfd06008b3763363 @Constellation Constellation committed Feb 12, 2014
Showing with 8 additions and 3 deletions.
  1. +8 −3 mod/gdev/gdev_drv_nvidia.c
View
11 mod/gdev/gdev_drv_nvidia.c
@@ -272,9 +272,14 @@ void gdev_raw_ctx_free(struct gdev_ctx *ctx)
fbo.map = ctx->fence.map;
gdev_drv_bo_free(&vspace, &fbo);
- dbo.priv = ctx->desc.bo;
- dbo.addr = ctx->desc.addr;
- gdev_drv_bo_free(&vspace, &dbo);
+ /* compute desc buffer is allocated only when a target chipset
+ * is NVE4 or later. Some chipset like NVC0 doesn't have it.
+ */
+ if (ctx->desc.bo) {
+ dbo.priv = ctx->desc.bo;
+ dbo.addr = ctx->desc.addr;
+ gdev_drv_bo_free(&vspace, &dbo);
+ }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
#if 0 /* un-necessary */

0 comments on commit f0e7e83

Please sign in to comment.