[PATCH] Fix -WMissing-braces compile warning on android

Jenny Cao jenny.q.cao at intel.com
Fri May 18 04:43:34 UTC 2018


use "{}" instead of "{0}" in empty struct defination to avoid missing-braces warning:
suggest braces around initialization of subobject [-Wmissing-braces]

Test: compilation on android with this warning free

Signed-off-by: Jenny Cao <jenny.q.cao at intel.com>
---
 amdgpu/amdgpu_cs.c | 4 ++--
 libsync.h          | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index 3c9be6c2e835..40e12a61d611 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -705,7 +705,7 @@ 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)
@@ -750,7 +750,7 @@ 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;
 
 	fth.in.fence.ctx_id = fence->context->id;
diff --git a/libsync.h b/libsync.h
index f1a2f96d36bc..b4d3251c704d 100644
--- a/libsync.h
+++ b/libsync.h
@@ -85,7 +85,7 @@ static inline int sync_wait(int fd, int timeout)
 
 static inline int sync_merge(const char *name, int fd1, int fd2)
 {
-	struct sync_merge_data data = {0};
+	struct sync_merge_data data = {};
 	int ret;
 
 	data.fd2 = fd2;
-- 
1.9.1



More information about the dri-devel mailing list