[PATCH 2/8] fix warn in intel_error_decode: ignoring return value of 'asprintf'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Imre Deak <imre.deak at intel.com>
---
 tools/intel_error_decode.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/intel_error_decode.c b/tools/intel_error_decode.c
index e0ec8f6..ca03c83 100644
--- a/tools/intel_error_decode.c
+++ b/tools/intel_error_decode.c
@@ -49,6 +49,7 @@
 #include <errno.h>
 #include <sys/stat.h>
 #include <err.h>
+#include <assert.h>
 #include <intel_bufmgr.h>
 
 #include "intel_chipset.h"
@@ -479,13 +480,18 @@ main (int argc, char *argv[])
     }
 
     if (S_ISDIR (st.st_mode)) {
-	asprintf (&filename, "%s/i915_error_state", path);
+	int ret;
+
+	ret = asprintf (&filename, "%s/i915_error_state", path);
+	assert(ret > 0);
 	file = fopen(filename, "r");
 	if (!file) {
 	    int minor;
 	    for (minor = 0; minor < 64; minor++) {
 		free(filename);
-		asprintf(&filename, "%s/%d/i915_error_state", path, minor);
+		ret = asprintf(&filename, "%s/%d/i915_error_state", path, minor);
+		assert(ret > 0);
+
 		file = fopen(filename, "r");
 		if (file)
 		    break;
-- 
1.7.9.5



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux