All of lore.kernel.org
 help / color / mirror / Atom feed
From: Diego Celix <dcelix@gmail.com>
To: Julien Cristau <jcristau@debian.org>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [intel-gfx][intel-gpu-tools][patch] Review of some patches to get rid of some compile warnings
Date: Thu, 10 Feb 2011 10:34:15 +0000	[thread overview]
Message-ID: <AANLkTinouaStvyhqSyE06gg8cde1hpHMB3gVs=oupdpo@mail.gmail.com> (raw)
In-Reply-To: <20110209213424.GT20496@radis.liafa.jussieu.fr>


[-- Attachment #1.1: Type: text/plain, Size: 322 bytes --]

2011/2/9 Julien Cristau <jcristau@debian.org>

> You should include this information (the warning messages that you
> fixed) in the commit messages themselves.
>
> Cheers,
> Julien
>

Hi,

As you said, I have attached to this message the new patch files, with the
commit messages updated.


Cheers
-- 
Diego Celix Salgado

[-- Attachment #1.2: Type: text/html, Size: 642 bytes --]

[-- Attachment #2: 0001-Some-warning-fixes.patch --]
[-- Type: text/x-patch, Size: 1464 bytes --]

From 13f83fd1ab5eefe7b778c7f1fda6fbaf9e1e0efc Mon Sep 17 00:00:00 2001
From: Diego Celix <dcelix@gmail.com>
Date: Thu, 10 Feb 2011 09:56:17 +0000
Subject: [PATCH] Some warning fixes

These are the warnings fixed in this commit:
intel_disable_clock_gating.c:38: warning: unused variable 'temp'
intel_bios_reader.c:192: warning: format '%lu' expects type 'long
unsigned int', but argument 2 has type 'unsigned int'
---
 tools/intel_bios_reader.c          |    2 +-
 tools/intel_disable_clock_gating.c |    1 -
 2 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/tools/intel_bios_reader.c b/tools/intel_bios_reader.c
index c4b39b0..6515efb 100644
--- a/tools/intel_bios_reader.c
+++ b/tools/intel_bios_reader.c
@@ -189,7 +189,7 @@ static void dump_backlight_info(void)
 
 	if (sizeof(struct blc_struct) != backlight->blcstruct_size) {
 		printf("\tBacklight struct sizes don't match (expected %lu, got %u), skipping\n",
-		     sizeof(struct blc_struct), backlight->blcstruct_size);
+		     (unsigned long) sizeof(struct blc_struct), backlight->blcstruct_size);
 		return;
 	}
 
diff --git a/tools/intel_disable_clock_gating.c b/tools/intel_disable_clock_gating.c
index 9b802de..8dde3e1 100644
--- a/tools/intel_disable_clock_gating.c
+++ b/tools/intel_disable_clock_gating.c
@@ -35,7 +35,6 @@
 int main(int argc, char** argv)
 {
 	struct pci_device *pci_dev;
-	uint32_t temp;
 
 	pci_dev = intel_get_pci_device();
 	intel_get_mmio(pci_dev);
-- 
1.7.3.4


[-- Attachment #3: 0002-intel_error_decode-asprintf-warning-fix.patch --]
[-- Type: text/x-patch, Size: 1755 bytes --]

From 55ab97e5cc38fb76d6be7b1b952ceb4b2ad26ab2 Mon Sep 17 00:00:00 2001
From: Diego Celix <dcelix@gmail.com>
Date: Thu, 10 Feb 2011 09:59:23 +0000
Subject: [PATCH] intel_error_decode: asprintf warning fix

This commit fixes the next compile warnings:
intel_error_decode.c:374: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_error_decode.c:380: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
---
 tools/intel_error_decode.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/intel_error_decode.c b/tools/intel_error_decode.c
index a27ade9..85dfee4 100644
--- a/tools/intel_error_decode.c
+++ b/tools/intel_error_decode.c
@@ -371,13 +371,19 @@ main (int argc, char *argv[])
     }
 
     if (S_ISDIR (st.st_mode)) {
-	asprintf (&filename, "%s/i915_error_state", path);
+	if (asprintf (&filename, "%s/i915_error_state", path) == -1) {
+	    fprintf (stderr, "Failed to allocate string for the path of the i915_error_state file\n");
+	    exit (1);
+	}
 	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);
+		if (asprintf(&filename, "%s/%d/i915_error_state", path, minor) == -1) {
+                    fprintf (stderr, "Failed to allocate string for the path of the i915_error_state file\n");
+		    exit (1);
+		}
 		file = fopen(filename, "r");
 		if (file)
 		    break;
@@ -386,6 +392,7 @@ main (int argc, char *argv[])
 	if (!file) {
 	    fprintf (stderr, "Failed to find i915_error_state beneath %s\n",
 		     path);
+	    free(filename);	
 	    exit (1);
 	}
     } else {
-- 
1.7.3.4


[-- Attachment #4: 0003-intel_gpu_dump-asprintf-warning-fix.patch --]
[-- Type: text/x-patch, Size: 4304 bytes --]

From ff5e47657c1d832abaf585b3dfcc3ed4b213c708 Mon Sep 17 00:00:00 2001
From: Diego Celix <dcelix@gmail.com>
Date: Thu, 10 Feb 2011 10:02:46 +0000
Subject: [PATCH] intel_gpu_dump: asprintf warning fix

This commit fixes the next compile warnings:
intel_gpu_dump.c:308: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_gpu_dump.c:357: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_gpu_dump.c:362: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_gpu_dump.c:370: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_gpu_dump.c:375: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_gpu_dump.c:382: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_gpu_dump.c:387: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
---
 tools/intel_gpu_dump.c |   35 ++++++++++++++++++++++++++++-------
 1 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/tools/intel_gpu_dump.c b/tools/intel_gpu_dump.c
index 4cf4576..2a0bf9f 100644
--- a/tools/intel_gpu_dump.c
+++ b/tools/intel_gpu_dump.c
@@ -305,7 +305,10 @@ main (int argc, char *argv[])
 	char *filename;
 	uint32_t ring_head, ring_tail, acthd;
 
-	asprintf(&filename, "%s/i915_ringbuffer_info", path);
+	if (asprintf(&filename, "%s/i915_ringbuffer_info", path) == -1) {
+	    fprintf (stderr, "Failed to allocate string for the path of the i195_ring_buffer_info file\n");
+	    exit (1);
+	}
 
 	err = stat(filename, &st);
 	if (err != 0) {
@@ -354,12 +357,18 @@ main (int argc, char *argv[])
 
 	print_instdone (instdone, instdone1);
 
-	asprintf (&filename, "%s/i915_batchbuffers", path);
+	if (asprintf (&filename, "%s/i915_batchbuffers", path) == -1) {
+	    fprintf (stderr, "Failed to allocate string for the path of the i195_batchbuffers file\n");
+	    exit (1);
+	}
 	intel_decode_context_set_head_tail(acthd, 0xffffffff);
 	read_data_file (devid, filename, 1);
 	free (filename);
 
-	asprintf (&filename, "%s/i915_ringbuffer_data", path);
+	if (asprintf (&filename, "%s/i915_ringbuffer_data", path) == -1) {
+            fprintf (stderr, "Failed to allocate string for the path of the i195_ringbuffer_data file\n");
+	    exit (1);
+	}
 	intel_decode_context_set_head_tail(ring_head, ring_tail);
 	printf("Ringbuffer: ");
 	printf("Reminder: head pointer is GPU read, tail pointer is CPU "
@@ -367,24 +376,36 @@ main (int argc, char *argv[])
 	read_data_file (devid, filename, 0);
 	free (filename);
 
-	asprintf(&filename, "%s/i915_blt_ringbuffer_info", path);
+	if (asprintf(&filename, "%s/i915_blt_ringbuffer_info", path) == -1) {
+            fprintf (stderr, "Failed to allocate string for the path of the i195_blt_ringbuffer_info file\n");
+	    exit (1);
+	}
 	if (stat(filename, &st) == 0) {
 		parse_ringbuffer_info(filename, &ring_head, &ring_tail, &acthd);
 		free(filename);
 
-		asprintf (&filename, "%s/i915_blt_ringbuffer_data", path);
+		if (asprintf (&filename, "%s/i915_blt_ringbuffer_data", path) == -1) {
+                    fprintf (stderr, "Failed to allocate string for the path of the i195_blt_ringbuffer_data file\n");
+		    exit (1);
+		}
 		intel_decode_context_set_head_tail(ring_head, ring_tail);
 		printf("BLT Ringbuffer: ");
 		read_data_file (devid, filename, 0);
 	}
 	free (filename);
 
-	asprintf(&filename, "%s/i915_bsd_ringbuffer_info", path);
+	if (asprintf(&filename, "%s/i915_bsd_ringbuffer_info", path) == -1) {
+            fprintf (stderr, "Failed to allocate string for the path of the i195_bsd_ringbuffer_info file\n");
+	    exit (1);
+	}
 	if (stat(filename, &st) == 0) {
 		parse_ringbuffer_info(filename, &ring_head, &ring_tail, &acthd);
 		free(filename);
 
-		asprintf (&filename, "%s/i915_bsd_ringbuffer_data", path);
+		if (asprintf (&filename, "%s/i915_bsd_ringbuffer_data", path) == -1) {
+                    fprintf (stderr, "Failed to allocate string for the path of the i195_bsd_ringbuffer_data file\n");
+		    exit (1);
+		}
 		intel_decode_context_set_head_tail(ring_head, ring_tail);
 		printf("BSD Ringbuffer: ");
 		read_data_file (devid, filename, 0);
-- 
1.7.3.4


[-- Attachment #5: 0004-intel_reg_snapshot-Warning-fix.patch --]
[-- Type: text/x-patch, Size: 1048 bytes --]

From ea8b641427362c185a52f4cd8bf11452e2058461 Mon Sep 17 00:00:00 2001
From: Diego Celix <dcelix@gmail.com>
Date: Thu, 10 Feb 2011 10:05:06 +0000
Subject: [PATCH] intel_reg_snapshot: Warning fix

This commit fixes the next compile warning:
intel_reg_snapshot.c:45: warning: ignoring return value of 'write',
declared with attribute warn_unused_result
---
 tools/intel_reg_snapshot.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/tools/intel_reg_snapshot.c b/tools/intel_reg_snapshot.c
index fcc8b81..dde419c 100644
--- a/tools/intel_reg_snapshot.c
+++ b/tools/intel_reg_snapshot.c
@@ -25,6 +25,7 @@
  */
 
 #include <unistd.h>
+#include <stdio.h>
 #include "intel_gpu_tools.h"
 
 int main(int argc, char** argv)
@@ -42,7 +43,10 @@ int main(int argc, char** argv)
 	else
 		mmio_bar = 1;
 
-	write(1, mmio, pci_dev->regions[mmio_bar].size);
+	if (write(1, mmio, pci_dev->regions[mmio_bar].size) == -1) {
+		fprintf(stderr, "Writing to the filedescriptor has failed\n");
+		return 1;
+	}
 
 	return 0;
 }
-- 
1.7.3.4


[-- Attachment #6: 0005-intel_reg_dumper-asprintf-warning-fix.patch --]
[-- Type: text/x-patch, Size: 34300 bytes --]

From 3a934d27f6e8339783e87f6aa1ba5ef06d7aef56 Mon Sep 17 00:00:00 2001
From: Diego Celix <dcelix@gmail.com>
Date: Wed, 9 Feb 2011 17:36:15 +0000
Subject: [PATCH] intel_reg_dumper: asprintf warning fix

This commit fixes the next warnings:
intel_reg_dumper.c:42: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:74: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:99: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:112: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:118: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:124: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:129: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:137: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:139: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:171: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:173: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:227: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:258: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:265: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:272: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:310: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:332: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:337: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:423: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:440: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:456: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:459: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:482: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:509: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:530: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:569: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:591: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:595: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:609: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:620: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:896: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:902: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:908: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:1005: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:1082: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:1102: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:1151: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:1183: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:1221: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:1228: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:1233: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:1272: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:1289: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:1296: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:1303: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:1315: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:1372: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:1402: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:1455: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
intel_reg_dumper.c:1461: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result
---
 tools/intel_reg_dumper.c |  557 +++++++++++++++++++++++++++++++---------------
 1 files changed, 382 insertions(+), 175 deletions(-)

diff --git a/tools/intel_reg_dumper.c b/tools/intel_reg_dumper.c
index fb242d7..3f26179 100644
--- a/tools/intel_reg_dumper.c
+++ b/tools/intel_reg_dumper.c
@@ -35,16 +35,22 @@
 
 static uint32_t devid;
 
+#define ASPRINTF_ERROR (const char *)("Failed to allocate string with asprintf function\n")
+
 #define DEBUGSTRING(func) static void func(char **result, int reg, uint32_t val)
 
 DEBUGSTRING(i830_16bit_func)
 {
-	asprintf(result, "0x%04x", (uint16_t) val);
+	if (asprintf(result, "0x%04x", (uint16_t) val) == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_dcc)
 {
 	char *addressing = NULL;
+	int ret;
 
 	if (!IS_MOBILE(devid))
 		return;
@@ -71,15 +77,20 @@ DEBUGSTRING(i830_debug_dcc)
 		}
 	}
 
-	asprintf(result, "%s, XOR randomization: %sabled, XOR bit: %d",
-		 addressing,
-		 (val & (1 << 10)) ? "dis" : "en",
-		 (val & (1 << 9)) ? 17 : 11);
+	ret = asprintf(result, "%s, XOR randomization: %sabled, XOR bit: %d",
+		       addressing,
+		       (val & (1 << 10)) ? "dis" : "en",
+		       (val & (1 << 9)) ? 17 : 11);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_chdecmisc)
 {
 	char *enhmodesel = NULL;
+	int ret;
 
 	switch ((val >> 5) & 3) {
 	case 1:
@@ -96,47 +107,68 @@ DEBUGSTRING(i830_debug_chdecmisc)
 		break;
 	}
 
-	asprintf(result,
-		 "%s, ch2 enh %sabled, ch1 enh %sabled, "
-		 "ch0 enh %sabled, "
-		 "flex %sabled, ep %spresent", enhmodesel,
-		 (val & (1 << 4)) ? "en" : "dis",
-		 (val & (1 << 3)) ? "en" : "dis",
-		 (val & (1 << 2)) ? "en" : "dis",
-		 (val & (1 << 1)) ? "en" : "dis",
-		 (val & (1 << 0)) ? "" : "not ");
+	ret = asprintf(result,
+		       "%s, ch2 enh %sabled, ch1 enh %sabled, "
+		       "ch0 enh %sabled, "
+		       "flex %sabled, ep %spresent", enhmodesel,
+		       (val & (1 << 4)) ? "en" : "dis",
+		       (val & (1 << 3)) ? "en" : "dis",
+		       (val & (1 << 2)) ? "en" : "dis",
+		       (val & (1 << 1)) ? "en" : "dis",
+		       (val & (1 << 0)) ? "" : "not ");
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_xyminus1)
 {
-	asprintf(result, "%d, %d", (val & 0xffff) + 1,
-		 ((val & 0xffff0000) >> 16) + 1);
+	if (asprintf(result, "%d, %d", (val & 0xffff) + 1,
+		     ((val & 0xffff0000) >> 16) + 1) == -1) {
+                fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_yxminus1)
 {
-	asprintf(result, "%d, %d", ((val & 0xffff0000) >> 16) + 1,
-		 (val & 0xffff) + 1);
+	if (asprintf(result, "%d, %d", ((val & 0xffff0000) >> 16) + 1,
+		     (val & 0xffff) + 1) == -1 ) {
+                fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_xy)
 {
-	asprintf(result, "%d, %d", (val & 0xffff), ((val & 0xffff0000) >> 16));
+	if (asprintf(result, "%d, %d", (val & 0xffff), ((val & 0xffff0000) >> 16)) == -1) {
+                fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_dspstride)
 {
-	asprintf(result, "%d bytes", val);
+	if (asprintf(result, "%d bytes", val) == -1) {
+                fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_dspcntr)
 {
 	char *enabled = val & DISPLAY_PLANE_ENABLE ? "enabled" : "disabled";
 	char plane = val & DISPPLANE_SEL_PIPE_B ? 'B' : 'A';
+	int ret;
 	if (HAS_PCH_SPLIT(devid))
-		asprintf(result, "%s", enabled);
+		ret = asprintf(result, "%s", enabled);
 	else
-		asprintf(result, "%s, pipe %c", enabled, plane);
+		ret = asprintf(result, "%s, pipe %c", enabled, plane);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_pipeconf)
@@ -144,6 +176,7 @@ DEBUGSTRING(i830_debug_pipeconf)
 	char *enabled = val & PIPEACONF_ENABLE ? "enabled" : "disabled";
 	char *bit30;
 	char *bpc = NULL;
+	int ret;
 
 	if (IS_965(devid))
 		bit30 = val & I965_PIPECONF_ACTIVE ? "active" : "inactive";
@@ -168,9 +201,13 @@ DEBUGSTRING(i830_debug_pipeconf)
 		}
 	}
 	if (HAS_PCH_SPLIT(devid))
-		asprintf(result, "%s, %s, %s", enabled, bit30, bpc);
+		ret = asprintf(result, "%s, %s, %s", enabled, bit30, bpc);
 	else
-		asprintf(result, "%s, %s", enabled, bit30);
+		ret = asprintf(result, "%s, %s", enabled, bit30);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_pipestat)
@@ -224,53 +261,73 @@ DEBUGSTRING(i830_debug_pipestat)
 	    val & VBLANK_INT_STATUS ? " VBLANK_INT_STATUS" : "";
 	char *_OREG_UPDATE_STATUS =
 	    val & OREG_UPDATE_STATUS ? " OREG_UPDATE_STATUS" : "";
-	asprintf(result,
-		 "status:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
-		 _FIFO_UNDERRUN,
-		 _CRC_ERROR_ENABLE,
-		 _CRC_DONE_ENABLE,
-		 _GMBUS_EVENT_ENABLE,
-		 _VSYNC_INT_ENABLE,
-		 _DLINE_COMPARE_ENABLE,
-		 _DPST_EVENT_ENABLE,
-		 _LBLC_EVENT_ENABLE,
-		 _OFIELD_INT_ENABLE,
-		 _EFIELD_INT_ENABLE,
-		 _SVBLANK_INT_ENABLE,
-		 _VBLANK_INT_ENABLE,
-		 _OREG_UPDATE_ENABLE,
-		 _CRC_ERROR_INT_STATUS,
-		 _CRC_DONE_INT_STATUS,
-		 _GMBUS_INT_STATUS,
-		 _VSYNC_INT_STATUS,
-		 _DLINE_COMPARE_STATUS,
-		 _DPST_EVENT_STATUS,
-		 _LBLC_EVENT_STATUS,
-		 _OFIELD_INT_STATUS,
-		 _EFIELD_INT_STATUS,
-		 _SVBLANK_INT_STATUS,
-		 _VBLANK_INT_STATUS,
-		 _OREG_UPDATE_STATUS);
+	int ret;
+	ret = asprintf(result,
+		       "status:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+		       _FIFO_UNDERRUN,
+		       _CRC_ERROR_ENABLE,
+		       _CRC_DONE_ENABLE,
+		       _GMBUS_EVENT_ENABLE,
+		       _VSYNC_INT_ENABLE,
+		       _DLINE_COMPARE_ENABLE,
+		       _DPST_EVENT_ENABLE,
+		       _LBLC_EVENT_ENABLE,
+		       _OFIELD_INT_ENABLE,
+		       _EFIELD_INT_ENABLE,
+		       _SVBLANK_INT_ENABLE,
+		       _VBLANK_INT_ENABLE,
+		       _OREG_UPDATE_ENABLE,
+		       _CRC_ERROR_INT_STATUS,
+		       _CRC_DONE_INT_STATUS,
+		       _GMBUS_INT_STATUS,
+		       _VSYNC_INT_STATUS,
+		       _DLINE_COMPARE_STATUS,
+		       _DPST_EVENT_STATUS,
+		       _LBLC_EVENT_STATUS,
+		       _OFIELD_INT_STATUS,
+		       _EFIELD_INT_STATUS,
+		       _SVBLANK_INT_STATUS,
+		       _VBLANK_INT_STATUS,
+		       _OREG_UPDATE_STATUS);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_hvtotal)
 {
-	asprintf(result, "%d active, %d total",
-		 (val & 0xffff) + 1,
-		 ((val & 0xffff0000) >> 16) + 1);
+	int ret;
+	ret = asprintf(result, "%d active, %d total",
+		       (val & 0xffff) + 1,
+		       ((val & 0xffff0000) >> 16) + 1);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_hvsyncblank)
 {
-	asprintf(result, "%d start, %d end",
-		 (val & 0xffff) + 1,
-		 ((val & 0xffff0000) >> 16) + 1);
+	int ret;
+	ret = asprintf(result, "%d start, %d end",
+		       (val & 0xffff) + 1,
+		       ((val & 0xffff0000) >> 16) + 1);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_vgacntrl)
 {
-	asprintf(result, "%s",
-		 val & VGA_DISP_DISABLE ? "disabled" : "enabled");
+	int ret;
+	ret = asprintf(result, "%s",
+		       val & VGA_DISP_DISABLE ? "disabled" : "enabled");
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_fp)
@@ -292,6 +349,7 @@ DEBUGSTRING(i830_debug_fp)
 DEBUGSTRING(i830_debug_vga_pd)
 {
 	int vga0_p1, vga0_p2, vga1_p1, vga1_p2;
+	int ret;
 
 	/* XXX: i9xx version */
 
@@ -307,8 +365,12 @@ DEBUGSTRING(i830_debug_vga_pd)
 		vga1_p1 = ((val & VGA1_PD_P1_MASK) >> VGA1_PD_P1_SHIFT) + 2;
 	vga1_p2 = (val & VGA1_PD_P2_DIV_4) ? 4 : 2;
 
-	asprintf(result, "vga0 p1 = %d, p2 = %d, vga1 p1 = %d, p2 = %d",
+	ret = asprintf(result, "vga0 p1 = %d, p2 = %d, vga1 p1 = %d, p2 = %d",
 			 vga0_p1, vga0_p2, vga1_p1, vga1_p2);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_pp_status)
@@ -329,13 +391,19 @@ DEBUGSTRING(i830_debug_pp_status)
 		break;
 	}
 
-	asprintf(result, "%s, %s, sequencing %s", status, ready, seq);
+	if (asprintf(result, "%s, %s, sequencing %s", status, ready, seq) == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_pp_control)
 {
-	asprintf(result, "power target: %s",
-			 val & POWER_TARGET_ON ? "on" : "off");
+	if (asprintf(result, "power target: %s",
+			 val & POWER_TARGET_ON ? "on" : "off") == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_dpll)
@@ -348,6 +416,7 @@ DEBUGSTRING(i830_debug_dpll)
 	char *fpextra = val & DISPLAY_RATE_SELECT_FPA1 ? ", using FPx1!" : "";
 	char sdvoextra[20];
 	int p1, p2 = 0;
+	int ret;
 
 	if (IS_9XX(devid)) {
 		if (IS_IGD(devid)) {
@@ -420,10 +489,14 @@ DEBUGSTRING(i830_debug_dpll)
 		sdvoextra[0] = '\0';
 	}
 
-	asprintf(result, "%s, %s%s, %s clock, %s mode, p1 = %d, "
-			 "p2 = %d%s%s",
-			 enabled, dvomode, vgamode, clock, mode, p1, p2,
-			 fpextra, sdvoextra);
+	ret = asprintf(result, "%s, %s%s, %s clock, %s mode, p1 = %d, "
+			       "p2 = %d%s%s",
+			       enabled, dvomode, vgamode, clock, mode, p1, p2,
+			       fpextra, sdvoextra);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_dpll_test)
@@ -436,10 +509,15 @@ DEBUGSTRING(i830_debug_dpll_test)
 	char *dpllbmdiv = val & DPLLB_TEST_M_BYPASS ? ", DPLLB M bypassed" : "";
 	char *dpllbinput = val & DPLLB_INPUT_BUFFER_ENABLE ?
 	    "" : ", DPLLB input buffer disabled";
-
-	asprintf(result, "%s%s%s%s%s%s",
-			 dpllandiv, dpllamdiv, dpllainput,
-			 dpllbndiv, dpllbmdiv, dpllbinput);
+	int ret;
+
+	ret = asprintf(result, "%s%s%s%s%s%s",
+			       dpllandiv, dpllamdiv, dpllainput,
+			       dpllbndiv, dpllbmdiv, dpllbinput);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_adpa)
@@ -448,16 +526,21 @@ DEBUGSTRING(i830_debug_adpa)
 	char *enable = (val & ADPA_DAC_ENABLE) ? "enabled" : "disabled";
 	char hsync = (val & ADPA_HSYNC_ACTIVE_HIGH) ? '+' : '-';
 	char vsync = (val & ADPA_VSYNC_ACTIVE_HIGH) ? '+' : '-';
+	int ret;
 
 	if (HAS_CPT)
 		pipe = val & (1<<29) ? 'B' : 'A';
 
 	if (HAS_PCH_SPLIT(devid))
-		asprintf(result, "%s, transcoder %c, %chsync, %cvsync",
-				 enable, pipe, hsync, vsync);
+		ret = asprintf(result, "%s, transcoder %c, %chsync, %cvsync",
+				       enable, pipe, hsync, vsync);
 	else
-		asprintf(result, "%s, pipe %c, %chsync, %cvsync",
-				 enable, pipe, hsync, vsync);
+		ret = asprintf(result, "%s, pipe %c, %chsync, %cvsync",
+				       enable, pipe, hsync, vsync);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_lvds)
@@ -466,6 +549,7 @@ DEBUGSTRING(i830_debug_lvds)
 	char *enable = val & LVDS_PORT_EN ? "enabled" : "disabled";
 	int depth;
 	char *channels;
+	int ret;
 
 	if ((val & LVDS_A3_POWER_MASK) == LVDS_A3_POWER_UP)
 		depth = 24;
@@ -479,8 +563,12 @@ DEBUGSTRING(i830_debug_lvds)
 	if (HAS_CPT)
 		pipe = val & (1<<29) ? 'B' : 'A';
 
-	asprintf(result, "%s, pipe %c, %d bit, %s",
-			 enable, pipe, depth, channels);
+	ret = asprintf(result, "%s, pipe %c, %d bit, %s",
+			       enable, pipe, depth, channels);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_dvo)
@@ -490,6 +578,7 @@ DEBUGSTRING(i830_debug_dvo)
 	char *stall;
 	char hsync = val & DVO_HSYNC_ACTIVE_HIGH ? '+' : '-';
 	char vsync = val & DVO_VSYNC_ACTIVE_HIGH ? '+' : '-';
+	int ret;
 
 	switch (val & DVO_PIPE_STALL_MASK) {
 	case DVO_PIPE_STALL_UNUSED:
@@ -506,8 +595,12 @@ DEBUGSTRING(i830_debug_dvo)
 		break;
 	}
 
-	asprintf(result, "%s, pipe %c, %s, %chsync, %cvsync",
-			 enable, pipe, stall, hsync, vsync);
+	ret = asprintf(result, "%s, pipe %c, %s, %chsync, %cvsync",
+			       enable, pipe, stall, hsync, vsync);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_sdvo)
@@ -518,6 +611,7 @@ DEBUGSTRING(i830_debug_sdvo)
 	char *detected = val & SDVO_DETECTED ? "" : "not ";
 	char *gang = val & SDVOC_GANG_MODE ? ", gang mode" : "";
 	char sdvoextra[20];
+	int ret;
 
 	if (IS_915(devid)) {
 		sprintf(sdvoextra, ", SDVO mult %d",
@@ -527,8 +621,12 @@ DEBUGSTRING(i830_debug_sdvo)
 		sdvoextra[0] = '\0';
 	}
 
-	asprintf(result, "%s, pipe %c, stall %s, %sdetected%s%s",
-			 enable, pipe, stall, detected, sdvoextra, gang);
+	ret = asprintf(result, "%s, pipe %c, stall %s, %sdetected%s%s",
+			       enable, pipe, stall, detected, sdvoextra, gang);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i830_debug_dspclk_gate_d)
@@ -565,14 +663,19 @@ DEBUGSTRING(i830_debug_dspclk_gate_d)
 	char *OVCUNIT = val & OVCUNIT_CLOCK_GATE_DISABLE ? " OVCUNIT" : "";
 	char *OVUUNIT = val & OVUUNIT_CLOCK_GATE_DISABLE ? " OVUUNIT" : "";
 	char *OVLUNIT = val & OVLUNIT_CLOCK_GATE_DISABLE ? " OVLUNIT" : "";
-
-	asprintf(result,
-		 "clock gates disabled:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
-		 DPUNIT_B, VSUNIT, VRHUNIT, VRDUNIT, AUDUNIT, DPUNIT_A, DPCUNIT,
-		 TVRUNIT, TVCUNIT, TVFUNIT, TVEUNIT, DVSUNIT, DSSUNIT, DDBUNIT,
-		 DPRUNIT, DPFUNIT, DPBMUNIT, DPLSUNIT, DPLUNIT, DPOUNIT, DPBUNIT,
-		 DCUNIT, DPUNIT, VRUNIT, OVHUNIT, DPIOUNIT, OVFUNIT, OVBUNIT,
-		 OVRUNIT, OVCUNIT, OVUUNIT, OVLUNIT);
+	int ret;
+
+	ret = asprintf(result,
+		       "clock gates disabled:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+		       DPUNIT_B, VSUNIT, VRHUNIT, VRDUNIT, AUDUNIT, DPUNIT_A, DPCUNIT,
+		       TVRUNIT, TVCUNIT, TVFUNIT, TVEUNIT, DVSUNIT, DSSUNIT, DDBUNIT,
+		       DPRUNIT, DPFUNIT, DPBMUNIT, DPLSUNIT, DPLUNIT, DPOUNIT, DPBUNIT,
+		       DCUNIT, DPUNIT, VRUNIT, OVHUNIT, DPIOUNIT, OVFUNIT, OVBUNIT,
+		       OVRUNIT, OVCUNIT, OVUUNIT, OVLUNIT);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i810_debug_915_fence)
@@ -581,6 +684,7 @@ DEBUGSTRING(i810_debug_915_fence)
 	int pitch = 128 << ((val & 0x70) >> 4);
 	unsigned int offset = val & 0x0ff00000;
 	int size = (1024 * 1024) << ((val & 0x700) >> 8);
+	int ret;
 
 	if (IS_965(devid) || (IS_915(devid) && reg >= FENCE_NEW))
 		return;
@@ -588,11 +692,15 @@ DEBUGSTRING(i810_debug_915_fence)
 	if (format == 'X')
 		pitch *= 4;
 	if (val & 1) {
-		asprintf(result, "enabled, %c tiled, %4d pitch, 0x%08x - 0x%08x (%dkb)",
-			 format, pitch, offset, offset + size,
-			 size / 1024);
+		ret = asprintf(result, "enabled, %c tiled, %4d pitch, 0x%08x - 0x%08x (%dkb)",
+			       format, pitch, offset, offset + size,
+			       size / 1024);
 	} else {
-		asprintf(result, "disabled");
+		ret = asprintf(result, "disabled");
+	}
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
 	}
 }
 
@@ -602,12 +710,17 @@ DEBUGSTRING(i810_debug_965_fence_start)
 	char format = (val & I965_FENCE_Y_MAJOR) ? 'Y' : 'X';
 	int pitch = ((val & 0xffc) >> 2) * 128 + 128;
 	unsigned int offset = val & 0xfffff000;
+	int ret;
 
 	if (!IS_965(devid))
 		return;
 
-	asprintf(result, "%s, %c tile walk, %4d pitch, 0x%08x start",
-		 enable, format, pitch, offset);
+	ret = asprintf(result, "%s, %c tile walk, %4d pitch, 0x%08x start",
+		       enable, format, pitch, offset);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(i810_debug_965_fence_end)
@@ -617,7 +730,10 @@ DEBUGSTRING(i810_debug_965_fence_end)
 	if (!IS_965(devid))
 		return;
 
-	asprintf(result, "                                   0x%08x end", end);
+	if (asprintf(result, "                                   0x%08x end", end) == -1) {
+		fprintf(stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 #define DEFINEREG(reg) \
@@ -893,25 +1009,39 @@ static struct reg_debug intel_debug_regs[] = {
 
 DEBUGSTRING(ironlake_debug_rr_hw_ctl)
 {
-	asprintf(result, "low %d, high %d", val & RR_HW_LOW_POWER_FRAMES_MASK,
-		 (val & RR_HW_HIGH_POWER_FRAMES_MASK) >> 8);
+	int ret;
+	ret = asprintf(result, "low %d, high %d", val & RR_HW_LOW_POWER_FRAMES_MASK,
+		       (val & RR_HW_HIGH_POWER_FRAMES_MASK) >> 8);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(ironlake_debug_m_tu)
 {
-	asprintf(result, "TU %d, val 0x%x %d", (val >> 25) + 1, val & 0xffffff,
-		 val & 0xffffff);
+	int ret;
+	ret = asprintf(result, "TU %d, val 0x%x %d", (val >> 25) + 1, val & 0xffffff,
+		       val & 0xffffff);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(ironlake_debug_n)
 {
-	asprintf(result, "val 0x%x %d", val & 0xffffff, val & 0xffffff);
+	if (asprintf(result, "val 0x%x %d", val & 0xffffff, val & 0xffffff) == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(ironlake_debug_fdi_tx_ctl)
 {
 	char *train = NULL, *voltage = NULL, *pre_emphasis = NULL, *portw =
 	    NULL;
+	int ret;
 
 	switch (val & FDI_LINK_TRAIN_NONE) {
 	case FDI_LINK_TRAIN_PATTERN_1:
@@ -1002,20 +1132,25 @@ DEBUGSTRING(ironlake_debug_fdi_tx_ctl)
 		break;
 	}
 
-	asprintf(result, "%s, train pattern %s, voltage swing %s,"
-		 "pre-emphasis %s, port width %s, enhanced framing %s, FDI PLL %s, scrambing %s, master mode %s",
-		 val & FDI_TX_ENABLE ? "enable" : "disable",
-		 train, voltage, pre_emphasis, portw,
-		 val & FDI_TX_ENHANCE_FRAME_ENABLE ? "enable" :
-		 "disable",
-		 val & FDI_TX_PLL_ENABLE ? "enable" : "disable",
-		 val & (1 << 7) ? "disable" : "enable",
-		 val & (1 << 0) ? "enable" : "disable");
+	ret = asprintf(result, "%s, train pattern %s, voltage swing %s,"
+		       "pre-emphasis %s, port width %s, enhanced framing %s, FDI PLL %s, scrambing %s, master mode %s",
+		       val & FDI_TX_ENABLE ? "enable" : "disable",
+		       train, voltage, pre_emphasis, portw,
+		       val & FDI_TX_ENHANCE_FRAME_ENABLE ? "enable" :
+		       "disable",
+		       val & FDI_TX_PLL_ENABLE ? "enable" : "disable",
+		       val & (1 << 7) ? "disable" : "enable",
+		       val & (1 << 0) ? "enable" : "disable");
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(ironlake_debug_fdi_rx_ctl)
 {
 	char *train = NULL, *portw = NULL, *bpc = NULL;
+	int ret;
 
 	if (HAS_CPT) {
 		switch (val & FDI_LINK_TRAIN_PATTERN_MASK_CPT) {
@@ -1079,27 +1214,34 @@ DEBUGSTRING(ironlake_debug_fdi_rx_ctl)
 		break;
 	}
 
-	asprintf(result, "%s, train pattern %s, port width %s, %s,"
-		 "link_reverse_strap_overwrite %s, dmi_link_reverse %s, FDI PLL %s,"
-		 "FS ecc %s, FE ecc %s, FS err report %s, FE err report %s,"
-		 "scrambing %s, enhanced framing %s, %s",
-		 val & FDI_RX_ENABLE ? "enable" : "disable",
-		 train, portw, bpc,
-		 val & FDI_LINK_REVERSE_OVERWRITE ? "yes" : "no",
-		 val & FDI_DMI_LINK_REVERSE_MASK ? "yes" : "no",
-		 val & FDI_RX_PLL_ENABLE ? "enable" : "disable",
-		 val & FDI_FS_ERR_CORRECT_ENABLE ? "enable" : "disable",
-		 val & FDI_FE_ERR_CORRECT_ENABLE ? "enable" : "disable",
-		 val & FDI_FS_ERR_REPORT_ENABLE ? "enable" : "disable",
-		 val & FDI_FE_ERR_REPORT_ENABLE ? "enable" : "disable",
-		 val & (1 << 7) ? "disable" : "enable",
-		 val & FDI_RX_ENHANCE_FRAME_ENABLE ? "enable" :
-		 "disable", val & FDI_SEL_PCDCLK ? "PCDClk" : "RawClk");
+	ret = asprintf(result, "%s, train pattern %s, port width %s, %s,"
+		       "link_reverse_strap_overwrite %s, dmi_link_reverse %s, FDI PLL %s,"
+		       "FS ecc %s, FE ecc %s, FS err report %s, FE err report %s,"
+		       "scrambing %s, enhanced framing %s, %s",
+		       val & FDI_RX_ENABLE ? "enable" : "disable",
+		       train, portw, bpc,
+		       val & FDI_LINK_REVERSE_OVERWRITE ? "yes" : "no",
+		       val & FDI_DMI_LINK_REVERSE_MASK ? "yes" : "no",
+		       val & FDI_RX_PLL_ENABLE ? "enable" : "disable",
+		       val & FDI_FS_ERR_CORRECT_ENABLE ? "enable" : "disable",
+		       val & FDI_FE_ERR_CORRECT_ENABLE ? "enable" : "disable",
+		       val & FDI_FS_ERR_REPORT_ENABLE ? "enable" : "disable",
+		       val & FDI_FE_ERR_REPORT_ENABLE ? "enable" : "disable",
+		       val & (1 << 7) ? "disable" : "enable",
+		       val & FDI_RX_ENHANCE_FRAME_ENABLE ? "enable" :
+		       "disable", val & FDI_SEL_PCDCLK ? "PCDClk" : "RawClk");
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(ironlake_debug_dspstride)
 {
-	asprintf(result, "%d", val >> 6);
+	if (asprintf(result, "%d", val >> 6) == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(ironlake_debug_pch_dpll)
@@ -1111,6 +1253,7 @@ DEBUGSTRING(ironlake_debug_pch_dpll)
 	int fpa0_p1, fpa1_p1;
 	char *refclk = NULL;
 	int sdvo_mul;
+	int ret;
 
 	if ((val & DPLLB_MODE_LVDS) == DPLLB_MODE_LVDS) {
 		mode = "LVDS";
@@ -1148,10 +1291,14 @@ DEBUGSTRING(ironlake_debug_pch_dpll)
 
 	sdvo_mul = ((val & PLL_REF_SDVO_HDMI_MULTIPLIER_MASK) >> 9) + 1;
 
-	asprintf(result, "%s, sdvo high speed %s, mode %s, p2 %s, "
-		 "FPA0 P1 %d, FPA1 P1 %d, refclk %s, sdvo/hdmi mul %d",
-		 enable, highspeed, mode, p2, fpa0_p1, fpa1_p1, refclk,
-		 sdvo_mul);
+	ret = asprintf(result, "%s, sdvo high speed %s, mode %s, p2 %s, "
+		       "FPA0 P1 %d, FPA1 P1 %d, refclk %s, sdvo/hdmi mul %d",
+		       enable, highspeed, mode, p2, fpa0_p1, fpa1_p1, refclk,
+		       sdvo_mul);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(ironlake_debug_dref_ctl)
@@ -1166,6 +1313,7 @@ DEBUGSTRING(ironlake_debug_dref_ctl)
 	    val & DREF_SSC4_CENTERSPREAD ? "centerspread" : "downspread";
 	char *ssc1 = val & DREF_SSC1_ENABLE ? "enable" : "disable";
 	char *ssc4 = val & DREF_SSC4_ENABLE ? "enable" : "disable";
+	int ret;
 
 	switch (val & DREF_CPU_SOURCE_OUTPUT_NONSPREAD) {
 	case DREF_CPU_SOURCE_OUTPUT_DISABLE:
@@ -1180,15 +1328,20 @@ DEBUGSTRING(ironlake_debug_dref_ctl)
 	default:
 		cpu_source = "reserved";
 	}
-	asprintf(result, "cpu source %s, ssc_source %s, nonspread_source %s, "
-		 "superspread_source %s, ssc4_mode %s, ssc1 %s, ssc4 %s",
-		 cpu_source, ssc_source, nonspread_source,
-		 superspread_source, ssc4_mode, ssc1, ssc4);
+	ret = asprintf(result, "cpu source %s, ssc_source %s, nonspread_source %s, "
+		       "superspread_source %s, ssc4_mode %s, ssc1 %s, ssc4 %s",
+		       cpu_source, ssc_source, nonspread_source,
+		       superspread_source, ssc4_mode, ssc1, ssc4);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(ironlake_debug_rawclk_freq)
 {
 	char *tp1 = NULL, *tp2 = NULL;
+	int ret;
 
 	switch (val & FDL_TP1_TIMER_MASK) {
 	case 0:
@@ -1218,26 +1371,38 @@ DEBUGSTRING(ironlake_debug_rawclk_freq)
 		tp2 = "12.0us";
 		break;
 	}
-	asprintf(result, "FDL_TP1 timer %s, FDL_TP2 timer %s, freq %d",
-		 tp1, tp2, val & RAWCLK_FREQ_MASK);
-
+	ret = asprintf(result, "FDL_TP1 timer %s, FDL_TP2 timer %s, freq %d",
+		       tp1, tp2, val & RAWCLK_FREQ_MASK);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(ironlake_debug_fdi_rx_misc)
 {
-	asprintf(result, "FDI Delay %d", val & ((1 << 13) - 1));
+	if (asprintf(result, "FDI Delay %d", val & ((1 << 13) - 1)) == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(ironlake_debug_transconf)
 {
-	asprintf(result, "%s, %s",
-		 val & TRANS_ENABLE ? "enable" : "disable",
-		 val & TRANS_STATE_ENABLE ? "active" : "inactive");
+	int ret;
+	ret = asprintf(result, "%s, %s",
+		       val & TRANS_ENABLE ? "enable" : "disable",
+		       val & TRANS_STATE_ENABLE ? "active" : "inactive");
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(ironlake_debug_panel_fitting)
 {
 	char *vadapt = NULL, *filter_sel = NULL;
+	int ret;
 
 	switch (val & (3 << 25)) {
 	case 0:
@@ -1269,40 +1434,59 @@ DEBUGSTRING(ironlake_debug_panel_fitting)
 		break;
 	}
 
-	asprintf(result,
-		 "%s, auto_scale %s, auto_scale_cal %s, v_filter %s, vadapt %s, mode %s, filter_sel %s,"
-		 "chroma pre-filter %s, vert3tap %s, v_inter_invert %s",
-		 val & PF_ENABLE ? "enable" : "disable",
-		 val & (1 << 30) ? "no" : "yes",
-		 val & (1 << 29) ? "yes" : "no",
-		 val & (1 << 28) ? "bypass" : "enable",
-		 val & (1 << 27) ? "enable" : "disable",
-		 vadapt,
-		 filter_sel,
-		 val & (1 << 22) ? "enable" : "disable",
-		 val & (1 << 21) ? "force" : "auto",
-		 val & (1 << 20) ? "field 0" : "field 1");
+	ret = asprintf(result,
+		       "%s, auto_scale %s, auto_scale_cal %s, v_filter %s, vadapt %s, mode %s, filter_sel %s,"
+		       "chroma pre-filter %s, vert3tap %s, v_inter_invert %s",
+		       val & PF_ENABLE ? "enable" : "disable",
+		       val & (1 << 30) ? "no" : "yes",
+		       val & (1 << 29) ? "yes" : "no",
+		       val & (1 << 28) ? "bypass" : "enable",
+		       val & (1 << 27) ? "enable" : "disable",
+		       vadapt,
+		       filter_sel,
+		       val & (1 << 22) ? "enable" : "disable",
+		       val & (1 << 21) ? "force" : "auto",
+		       val & (1 << 20) ? "field 0" : "field 1");
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(ironlake_debug_panel_fitting_2)
 {
-	asprintf(result,
-		 "vscale %f",
-		 val / (float) (1<<15));
+	int ret;
+	ret = asprintf(result,
+		       "vscale %f",
+		       val / (float) (1<<15));
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(ironlake_debug_panel_fitting_3)
 {
-	asprintf(result,
-		 "vscale initial phase %f",
-		 val / (float) (1<<15));
+	int ret;
+	ret = asprintf(result,
+		       "vscale initial phase %f",
+		       val / (float) (1<<15));
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(ironlake_debug_panel_fitting_4)
 {
-	asprintf(result,
-		 "hscale %f",
-		 val / (float) (1<<15));
+	int ret;
+	ret = asprintf(result,
+		       "hscale %f",
+		       val / (float) (1<<15));
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(ironlake_debug_pf_win)
@@ -1312,13 +1496,17 @@ DEBUGSTRING(ironlake_debug_pf_win)
 	a = (val >> 16) & 0x1fff;
 	b = val & 0xfff;
 
-	asprintf(result, "%d, %d", a, b);
+	if (asprintf(result, "%d, %d", a, b) == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(ironlake_debug_hdmi)
 {
 	char *enable, pipe, *bpc = NULL, *encoding;
 	char *mode, *audio, *vsync, *hsync, *detect;
+	int ret;
 
 	if (val & PORT_ENABLE)
 		enable = "enabled";
@@ -1369,14 +1557,19 @@ DEBUGSTRING(ironlake_debug_hdmi)
 	else
 		detect = "non-detected";
 
-	asprintf(result, "%s pipe %c %s %s %s audio %s %s %s %s",
-		 enable, pipe, bpc, encoding, mode, audio, vsync, hsync, detect);
+	ret = asprintf(result, "%s pipe %c %s %s %s audio %s %s %s %s",
+		       enable, pipe, bpc, encoding, mode, audio, vsync, hsync, detect);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(snb_debug_dpll_sel)
 {
 	char *transa, *transb;
 	char *dplla = NULL, *dpllb = NULL;
+	int ret;
 
 	if (!HAS_CPT)
 		return;
@@ -1399,13 +1592,18 @@ DEBUGSTRING(snb_debug_dpll_sel)
 	} else
 		transb = "disable";
 
-	asprintf(result, "TransA DPLL %s (DPLL %s), TransB DPLL %s (DPLL %s)",
-		 transa, dplla, transb, dpllb);
+	ret = asprintf(result, "TransA DPLL %s (DPLL %s), TransB DPLL %s (DPLL %s)",
+		       transa, dplla, transb, dpllb);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(snb_debug_trans_dp_ctl)
 {
 	char *enable, *port = NULL, *bpc = NULL, *vsync, *hsync;
+	int ret;
 
 	if (!HAS_CPT)
 		return;
@@ -1452,16 +1650,25 @@ DEBUGSTRING(snb_debug_trans_dp_ctl)
 	else
 		hsync = "-hsync";
 
-	asprintf(result, "%s port %s %s %s %s",
-		 enable, port, bpc, vsync, hsync);
+	ret = asprintf(result, "%s port %s %s %s %s",
+		       enable, port, bpc, vsync, hsync);
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 DEBUGSTRING(ilk_debug_pp_control)
 {
-	asprintf(result, "blacklight %s, %spower down on reset, panel %s",
-		 (val & (1 << 2)) ? "enabled" : "disabled",
-		 (val & (1 << 1)) ? "" : "do not ",
-		 (val & (1 << 0)) ? "on" : "off");
+	int ret;
+	ret = asprintf(result, "blacklight %s, %spower down on reset, panel %s",
+		       (val & (1 << 2)) ? "enabled" : "disabled",
+		       (val & (1 << 1)) ? "" : "do not ",
+		       (val & (1 << 0)) ? "on" : "off");
+	if (ret == -1) {
+		fprintf (stderr, ASPRINTF_ERROR);
+		exit (1);
+	}
 }
 
 static struct reg_debug ironlake_debug_regs[] = {
-- 
1.7.3.4


[-- Attachment #7: 0006-intel_reg_dumper-if-else-fix-in-i830_debug_fp-functi.patch --]
[-- Type: text/x-patch, Size: 2151 bytes --]

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


[-- Attachment #8: Type: text/plain, Size: 159 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2011-02-10 10:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTi=R2Gqy3d3D6uZpQn0X7ipSf8C1_PzE=Et5jMPN@mail.gmail.com>
2011-02-09 18:00 ` [intel-gfx][intel-gpu-tools][patch] Review of some patches to get rid of some compile warnings Diego Celix
2011-02-09 21:34   ` Julien Cristau
2011-02-10 10:34     ` Diego Celix [this message]
2011-02-10 11:04       ` Chris Wilson
2011-02-10 11:43         ` Diego Celix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTinouaStvyhqSyE06gg8cde1hpHMB3gVs=oupdpo@mail.gmail.com' \
    --to=dcelix@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jcristau@debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.