[Piglit] [PATCH] cl-api-get-platform-ids: Initialize variable.
Vinson Lee
vlee at freedesktop.org
Tue Jul 1 22:38:56 PDT 2014
Fix clang sometimes-uninitialized warning.
get-platform-ids.c:62:5: warning: variable 'platforms' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
get-platform-ids.c:93:30: note: uninitialized use occurs here
errNo = clGetPlatformIDs(0, platforms, NULL);
^~~~~~~~~
get-platform-ids.c:62:2: note: remove the 'if' if its condition is always false
if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
get-platform-ids.c:56:27: note: initialize the variable 'platforms' to silence this warning
cl_platform_id* platforms;
^
= NULL
Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
tests/cl/api/get-platform-ids.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/cl/api/get-platform-ids.c b/tests/cl/api/get-platform-ids.c
index 6cc734a..f94ab0c 100644
--- a/tests/cl/api/get-platform-ids.c
+++ b/tests/cl/api/get-platform-ids.c
@@ -53,7 +53,7 @@ piglit_cl_test(const int argc,
int i;
cl_int errNo;
cl_uint num_platforms;
- cl_platform_id* platforms;
+ cl_platform_id* platforms = NULL;
/*** Normal usage ***/
--
1.9.2
More information about the Piglit
mailing list