All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Stultz <john.stultz@linaro.org>
To: dri-devel <dri-devel@lists.freedesktop.org>
Cc: Sean Paul <seanpaul@chromium.org>,
	Marissa Wall <marissaw@google.com>,
	Alistair Strachan <astrachan@google.com>,
	Emil Velikov <emil.velikov@collabora.com>
Subject: [RFC][PATCH 2/5] libdrm: amdgpu: Initialize unions with memset rather than "= {0}"
Date: Fri, 19 Apr 2019 21:24:52 -0700	[thread overview]
Message-ID: <1555734295-31015-3-git-send-email-john.stultz@linaro.org> (raw)
In-Reply-To: <1555734295-31015-1-git-send-email-john.stultz@linaro.org>

Clang complains when initializing unions using "= {0}"
so instead use memset.

Cc: Emil Velikov <emil.velikov@collabora.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Alistair Strachan <astrachan@google.com>
Cc: Marissa Wall <marissaw@google.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 amdgpu/amdgpu_cs.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index 7ee844f..7c5b9d1 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -733,12 +733,13 @@ drm_public int amdgpu_cs_submit_raw(amdgpu_device_handle dev,
 				    struct drm_amdgpu_cs_chunk *chunks,
 				    uint64_t *seq_no)
 {
-	union drm_amdgpu_cs cs = {0};
+	union drm_amdgpu_cs cs;
 	uint64_t *chunk_array;
 	int i, r;
 	if (num_chunks == 0)
 		return -EINVAL;
 
+	memset(&cs, 0, sizeof(cs));
 	chunk_array = alloca(sizeof(uint64_t) * num_chunks);
 	for (i = 0; i < num_chunks; i++)
 		chunk_array[i] = (uint64_t)(uintptr_t)&chunks[i];
@@ -763,10 +764,11 @@ drm_public int amdgpu_cs_submit_raw2(amdgpu_device_handle dev,
 				     struct drm_amdgpu_cs_chunk *chunks,
 				     uint64_t *seq_no)
 {
-	union drm_amdgpu_cs cs = {0};
+	union drm_amdgpu_cs cs;
 	uint64_t *chunk_array;
 	int i, r;
 
+	memset(&cs, 0, sizeof(cs));
 	chunk_array = alloca(sizeof(uint64_t) * num_chunks);
 	for (i = 0; i < num_chunks; i++)
 		chunk_array[i] = (uint64_t)(uintptr_t)&chunks[i];
@@ -803,9 +805,10 @@ drm_public int amdgpu_cs_fence_to_handle(amdgpu_device_handle dev,
 					 uint32_t what,
 					 uint32_t *out_handle)
 {
-	union drm_amdgpu_fence_to_handle fth = {0};
+	union drm_amdgpu_fence_to_handle fth;
 	int r;
 
+	memset(&fth, 0, sizeof(fth));
 	fth.in.fence.ctx_id = fence->context->id;
 	fth.in.fence.ip_type = fence->ip_type;
 	fth.in.fence.ip_instance = fence->ip_instance;
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2019-04-20  4:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-20  4:24 [RFC][PATCH 0/5] libdrm: Patches from AOSP John Stultz
2019-04-20  4:24 ` [RFC][PATCH 1/5] libdrm: Use mmap64 instead of __mmap2 John Stultz
2019-04-22 15:03   ` Alex Deucher
2019-04-23  9:47   ` Emil Velikov
2019-04-20  4:24 ` John Stultz [this message]
2019-04-22 14:58   ` [RFC][PATCH 2/5] libdrm: amdgpu: Initialize unions with memset rather than "= {0}" Alex Deucher
2019-04-22 18:35     ` John Stultz
2019-04-23 12:51       ` Christian König
2019-04-23 10:13   ` Emil Velikov
2019-04-20  4:24 ` [RFC][PATCH 3/5] libdrm: Avoid additional drm open close John Stultz
2019-04-22 15:00   ` Alex Deucher
2019-04-20  4:24 ` [RFC][PATCH 4/5] libdrm: reduce number of reallocations in drmModeAtomicAddProperty John Stultz
2019-04-22 15:06   ` Alex Deucher
2019-04-23 10:12   ` Emil Velikov
2019-04-20  4:24 ` [RFC][PATCH 5/5] libdrm: omap: Add DRM_RDWR flag to dmabuf export John Stultz
2019-04-23 10:26   ` Emil Velikov
2019-04-23 12:56     ` Christian König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1555734295-31015-3-git-send-email-john.stultz@linaro.org \
    --to=john.stultz@linaro.org \
    --cc=astrachan@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.velikov@collabora.com \
    --cc=marissaw@google.com \
    --cc=seanpaul@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.