[Intel-gfx] [PATCH] sna: move up the assert check before DBG print message

Lim Siew Hoon siew.hoon.lim at intel.com
Tue Mar 1 01:49:21 UTC 2016


The assert check for c->bo should be done before DBG,
else it will hit memory access violation when c->bo
is null.

Signed-off-by: Lim Siew Hoon <siew.hoon.lim at intel.com>
Reviewed-by: Matt Roper <matthew.d.roper at intel.com>
Signed-off-by: Matt Roper <matthew.d.roper at intel.com>
---
 src/sna/sna_dri2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index 766ce6d..982bc89 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -278,9 +278,9 @@ sna_dri2_get_back(struct sna *sna,
 
 	bo = NULL;
 	list_for_each_entry(c, &priv->cache, link) {
+		assert(c->bo);
 		DBG(("%s: cache: handle=%d, active=%d\n",
 		     __FUNCTION__, c->bo ? c->bo->handle : 0, c->bo ? c->bo->active_scanout : -1));
-		assert(c->bo);
 		if (c->bo->active_scanout == 0) {
 			bo = c->bo;
 			name = c->name;
-- 
2.1.0



More information about the Intel-gfx mailing list