diff mbox

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

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

Commit Message

Diego Celix Feb. 9, 2011, 6 p.m. UTC
None
diff mbox

Patch

From b284f7b4223ac837735e4cf6f6eec498e124295a Mon Sep 17 00:00:00 2001
From: Diego Celix <dcelix@gmail.com>
Date: Wed, 9 Feb 2011 13:42:55 +0000
Subject: [PATCH] intel_reg_dumper: if:else fix in i830_debug_fp funcion

---
 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 ccd991f..ec3d5b4 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