Fix an off by one in the phys object cleanup code (the cleanup code was
going from 0-max_objs-1, but it looks like the free_phys_obj code was
expecting 1-max_objs?), and fix up a related warning while we're at it.

Signed-off-by: Jesse Barnes <jbar...@virtuousgeek.org>

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 96316fd..cfb19b8 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3344,10 +3344,10 @@ void i915_gem_free_phys_object(struct drm_device *dev, 
int id)
        drm_i915_private_t *dev_priv = dev->dev_private;
        struct drm_i915_gem_phys_object *phys_obj;
 
-       if (!dev_priv->mm.phys_objs[id - 1])
+       if (!dev_priv->mm.phys_objs[id])
                return;
 
-       phys_obj = dev_priv->mm.phys_objs[id - 1];
+       phys_obj = dev_priv->mm.phys_objs[id];
        if (phys_obj->cur_obj) {
                i915_gem_detach_phys_object(dev, phys_obj->cur_obj);
        }
@@ -3357,7 +3357,7 @@ void i915_gem_free_phys_object(struct drm_device *dev, 
int id)
 #endif
        drm_pci_free(dev, phys_obj->handle);
        kfree(phys_obj);
-       dev_priv->mm.phys_objs[id - 1] = NULL;
+       dev_priv->mm.phys_objs[id] = NULL;
 }
 
 void i915_gem_free_all_phys_object(struct drm_device *dev)
@@ -3427,7 +3427,7 @@ i915_gem_attach_phys_object(struct drm_device *dev,
                ret = i915_gem_init_phys_object(dev, id,
                                                obj->size);
                if (ret) {
-                       DRM_ERROR("failed to init phys object %d size: %d\n", 
id, obj->size);
+                       DRM_ERROR("failed to init phys object %d size: %d\n", 
id, (int)obj->size);
                        goto out;
                }
        }

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to