From: John Harrison <[email protected]>

There is a general theory that kzmalloc is better/safer than kmalloc, especially
for interesting data structures. This change updates the request structure
allocation to be zero filled. That also means it is no longer necessary to
explicitly clear the 'complete' field.

For: VIZ-4377
Signed-off-by: John Harrison <[email protected]>
---
 drivers/gpu/drm/i915/intel_lrc.c        |    3 +--
 drivers/gpu/drm/i915/intel_ringbuffer.c |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 2c984a4..02eeff5 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -802,13 +802,12 @@ static int logical_ring_alloc_request(struct 
intel_engine_cs *ring,
        if (ring->outstanding_lazy_request)
                return 0;
 
-       request = kmalloc(sizeof(*request), GFP_KERNEL);
+       request = kzalloc(sizeof(*request), GFP_KERNEL);
        if (request == NULL)
                return -ENOMEM;
 
        kref_init(&request->ref);
        request->ring = ring;
-       request->complete = false;
 
        ret = i915_gem_get_seqno(ring->dev, &request->seqno);
        if (ret) {
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c 
b/drivers/gpu/drm/i915/intel_ringbuffer.c
index b5e03d9..04c9572 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -2033,13 +2033,12 @@ intel_ring_alloc_request(struct intel_engine_cs *ring)
        if (ring->outstanding_lazy_request)
                return 0;
 
-       request = kmalloc(sizeof(*request), GFP_KERNEL);
+       request = kzalloc(sizeof(*request), GFP_KERNEL);
        if (request == NULL)
                return -ENOMEM;
 
        kref_init(&request->ref);
        request->ring = ring;
-       request->complete = false;
 
        ret = i915_gem_get_seqno(ring->dev, &request->seqno);
        if (ret) {
-- 
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to