diff mbox

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

Message ID 1349874285-31536-3-git-send-email-imre.deak@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Imre Deak Oct. 10, 2012, 1:04 p.m. UTC
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 tools/intel_error_decode.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff mbox

Patch

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;