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]>
Reviewed-by: Thomas Daniel <[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 6711020..a7d4b50 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -885,7 +885,7 @@ 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;
 
@@ -899,7 +899,6 @@ static int logical_ring_alloc_request(struct 
intel_engine_cs *ring,
 
        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 92c72b3..a62ac336 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -2041,13 +2041,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