An unbalanced unpin decrements in_gart from zero to -1. A subsequent
pin then skips backing-page and mapping setup. Warn with the device
context and leave through out so the reservation lock is still released.

Signed-off-by: Gabriel Gama <[email protected]>
---
diff --git a/drivers/gpu/drm/gma500/gem.c b/drivers/gpu/drm/gma500/gem.c
index 
7250bf660abd204f72e4fc07ff3e95e614252f30..920847cbc4cd7c8c1fbc4f307f29640e2ac10064
 100644
--- a/drivers/gpu/drm/gma500/gem.c
+++ b/drivers/gpu/drm/gma500/gem.c
@@ -85,7 +85,8 @@
        if (drm_WARN_ONCE(dev, ret, "dma_resv_lock() failed, ret=%d\n", ret))
                return;
 
-       WARN_ON(!pobj->in_gart);
+       if (drm_WARN_ON(dev, !pobj->in_gart))
+               goto out;
 
        --pobj->in_gart;
 

Reply via email to