intel: return error status from drm_intel_gem_bo_map
authorKeith Packard <keithp@keithp.com>
Sat, 13 Dec 2008 19:06:11 +0000 (11:06 -0800)
committerEric Anholt <eric@anholt.net>
Wed, 17 Dec 2008 18:28:25 +0000 (10:28 -0800)
Applications may actually care if the mapping operation failed, so when
it happens, return an error indication. errno is probably trashed by
fprintf though.

Signed-off-by: Keith Packard <keithp@keithp.com>
libdrm/intel/intel_bufmgr_gem.c

index c94f82e..dbce938 100644 (file)
@@ -544,6 +544,8 @@ drm_intel_gem_bo_map(drm_intel_bo *bo, int write_enable)
            fprintf(stderr, "%s:%d: Error mapping buffer %d (%s): %s .\n",
                    __FILE__, __LINE__,
                    bo_gem->gem_handle, bo_gem->name, strerror(errno));
+           pthread_mutex_unlock(&bufmgr_gem->lock);
+           return ret;
        }
        bo_gem->virtual = (void *)(uintptr_t)mmap_arg.addr_ptr;
        bo_gem->swrast = 0;
@@ -566,6 +568,8 @@ drm_intel_gem_bo_map(drm_intel_bo *bo, int write_enable)
        if (ret != 0) {
            fprintf (stderr, "%s:%d: Error setting swrast %d: %s\n",
                     __FILE__, __LINE__, bo_gem->gem_handle, strerror (errno));
+           pthread_mutex_unlock(&bufmgr_gem->lock);
+           return ret;
        }
        bo_gem->swrast = 1;
     }