[Intel-gfx] [PATCH v5 06/11] drm/i915: tidy initialisation failure paths (legacy, part 2)
Dave Gordon
david.s.gordon at intel.com
Fri Feb 5 18:33:43 UTC 2016
After the last patch, there is only one caller of the trivial function
intel_destroy_ringbuffer_obj(), so we might as well fold it into the
caller.
v3:
Don't bother to clear a pointer in an object about to be freed.
[Chris Wilson]
v4:
Don't bother to check for NULL pointer, as drm_gem_object_unreference
can handle NULL [Chris Wilson]. This relies on 'base' being the very
first member of 'struct intel_ringbuffer'!
Signed-off-by: Dave Gordon <david.s.gordon at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
drivers/gpu/drm/i915/intel_ringbuffer.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 3e1aec8..284da10 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -2135,12 +2135,6 @@ int intel_pin_and_map_ringbuffer_obj(struct drm_device *dev,
return 0;
}
-static void intel_destroy_ringbuffer_obj(struct intel_ringbuffer *ringbuf)
-{
- drm_gem_object_unreference(&ringbuf->obj->base);
- ringbuf->obj = NULL;
-}
-
static int intel_alloc_ringbuffer_obj(struct drm_device *dev,
struct intel_ringbuffer *ringbuf)
{
@@ -2203,11 +2197,11 @@ struct intel_ringbuffer *
}
void
-intel_ringbuffer_free(struct intel_ringbuffer *ring)
+intel_ringbuffer_free(struct intel_ringbuffer *ringbuf)
{
- intel_destroy_ringbuffer_obj(ring);
- list_del(&ring->link);
- kfree(ring);
+ drm_gem_object_unreference(&ringbuf->obj->base);
+ list_del(&ringbuf->link);
+ kfree(ringbuf);
}
static int intel_init_ring_buffer(struct drm_device *dev,
--
1.9.1
More information about the Intel-gfx
mailing list