Mesa (master): i965/drm: Delete NULL check in brw_bo_unmap().

Kenneth Graunke kwg at kemper.freedesktop.org
Mon Apr 17 06:05:01 UTC 2017


Module: Mesa
Branch: master
Commit: 7c3b8ed87859bfdfb985d21685115a729f9cd138
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c3b8ed87859bfdfb985d21685115a729f9cd138

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Apr 12 09:30:48 2017 -0700

i965/drm: Delete NULL check in brw_bo_unmap().

I accidentally moved the bo->bufmgr dereference above the NULL check
when cleaning up this code.

While passing NULL to free() is a common pattern...passing NULL to
unmap seems pretty bad.  You really ought to know whether you have
a buffer or not.  We don't want to paper over bugs like that.  So,
just drop the NULL check altogether.

CID: 1405006

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

---

 src/mesa/drivers/dri/i965/brw_bufmgr.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c
index 64f5449867..4b6433178d 100644
--- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
+++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
@@ -827,9 +827,6 @@ brw_bo_unmap(struct brw_bo *bo)
    struct brw_bufmgr *bufmgr = bo->bufmgr;
    int ret = 0;
 
-   if (bo == NULL)
-      return 0;
-
    pthread_mutex_lock(&bufmgr->lock);
 
    if (bo->map_count <= 0) {




More information about the mesa-commit mailing list