Module: Mesa
Branch: main
Commit: 6fb52ba30eaf3aa1fa516eb00bbffcf1a2914d01
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6fb52ba30eaf3aa1fa516eb00bbffcf1a2914d01

Author: Pierre-Eric Pelloux-Prayer <[email protected]>
Date:   Tue Mar  8 11:46:38 2022 +0100

zink: replace opencoded slab_zalloc

Acked-By: Mike Blumenkrantz <[email protected]>
Acked-by: Emma Anholt <[email protected]>
Reviewed-by: Erik Faye-Lund <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15277>

---

 src/gallium/drivers/zink/zink_resource.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_resource.c 
b/src/gallium/drivers/zink/zink_resource.c
index 2c39ef14e15..a4ab94fdad8 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -1352,15 +1352,14 @@ create_transfer(struct zink_context *ctx, struct 
pipe_resource *pres, unsigned u
    struct zink_transfer *trans;
 
    if (usage & PIPE_MAP_THREAD_SAFE)
-      trans = malloc(sizeof(*trans));
+      trans = calloc(1, sizeof(*trans));
    else if (usage & TC_TRANSFER_MAP_THREADED_UNSYNC)
-      trans = slab_alloc(&ctx->transfer_pool_unsync);
+      trans = slab_zalloc(&ctx->transfer_pool_unsync);
    else
-      trans = slab_alloc(&ctx->transfer_pool);
+      trans = slab_zalloc(&ctx->transfer_pool);
    if (!trans)
       return NULL;
 
-   memset(trans, 0, sizeof(*trans));
    pipe_resource_reference(&trans->base.b.resource, pres);
 
    trans->base.b.usage = usage;

Reply via email to