Caught by Klockwork and I genuinely can't tell if it is safe without
it, especially since all the surrounding code is checking for NULL.

Signed-off-by: Martin Peres <martin.pe...@linux.intel.com>
---
 src/sna/sna_accel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 71a6207..8ceb1e1 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -3688,7 +3688,8 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, 
const BoxRec *box,
             __FUNCTION__, priv->flush, priv->shm, priv->cpu, flags));
 
        if ((flags & PREFER_GPU) == 0 &&
-           (flags & (REPLACES | IGNORE_DAMAGE) || !priv->gpu_damage || 
!kgem_bo_is_busy(priv->gpu_bo))) {
+           (flags & (REPLACES | IGNORE_DAMAGE) || !priv->gpu_damage ||
+            (priv->gpu_bo && !kgem_bo_is_busy(priv->gpu_bo)))) {
                DBG(("%s: try cpu as GPU bo is idle\n", __FUNCTION__));
                goto use_cpu_bo;
        }
-- 
2.7.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to