diff mbox

[intel-gpu-tools] Review of some patches to get rid of some compile warnings

Message ID AANLkTinouaStvyhqSyE06gg8cde1hpHMB3gVs=oupdpo@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Diego Celix Feb. 10, 2011, 10:34 a.m. UTC
None
diff mbox

Patch

From 46bb97f04cfce10a1c8ca00ed0bc423f2fb7ed41 Mon Sep 17 00:00:00 2001
From: Diego Celix <dcelix@gmail.com>
Date: Thu, 10 Feb 2011 10:07:34 +0000
Subject: [PATCH] intel_reg_dumper: if-else fix in i830_debug_fp function

This commit adds a change in the i830_debug_fp function. In this
function the result value of asprintf seems to be always overwritten
even if the if condition is satisfied.

Also, this commit fixes the next compile warnings:
intel_reg_dumper.c:279: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:286: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
---
 tools/intel_reg_dumper.c |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/tools/intel_reg_dumper.c b/tools/intel_reg_dumper.c
index 3f26179..c20e95e 100644
--- a/tools/intel_reg_dumper.c
+++ b/tools/intel_reg_dumper.c
@@ -332,18 +332,24 @@  DEBUGSTRING(i830_debug_vgacntrl)
 
 DEBUGSTRING(i830_debug_fp)
 {
+	int ret;
 	if (IS_IGD(devid)) {
-		asprintf(result, "n = %d, m1 = %d, m2 = %d",
-			 ffs((val & FP_N_IGD_DIV_MASK) >>
-			     FP_N_DIV_SHIFT) - 1,
-			 ((val & FP_M1_DIV_MASK) >> FP_M1_DIV_SHIFT),
-			 ((val & FP_M2_IGD_DIV_MASK) >>
-			  FP_M2_DIV_SHIFT));
-	}
-	asprintf(result, "n = %d, m1 = %d, m2 = %d",
-		 ((val & FP_N_DIV_MASK) >> FP_N_DIV_SHIFT),
-		 ((val & FP_M1_DIV_MASK) >> FP_M1_DIV_SHIFT),
-		 ((val & FP_M2_DIV_MASK) >> FP_M2_DIV_SHIFT));
+		ret = asprintf(result, "n = %d, m1 = %d, m2 = %d",
+			       ffs((val & FP_N_IGD_DIV_MASK) >>
+			           FP_N_DIV_SHIFT) - 1,
+			       ((val & FP_M1_DIV_MASK) >> FP_M1_DIV_SHIFT),
+			       ((val & FP_M2_IGD_DIV_MASK) >>
+			        FP_M2_DIV_SHIFT));
+	} else {
+		ret = asprintf(result, "n = %d, m1 = %d, m2 = %d",
+		               ((val & FP_N_DIV_MASK) >> FP_N_DIV_SHIFT),
+			       ((val & FP_M1_DIV_MASK) >> FP_M1_DIV_SHIFT),
+			       ((val & FP_M2_DIV_MASK) >> FP_M2_DIV_SHIFT));
+	}
+        if (ret == -1) {                        
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_vga_pd)
-- 
1.7.3.4