[PATCH 1/6] avivotool: make card detection and mapping errors non-fatal

Jonathan Nieder jrnieder at gmail.com
Mon Feb 20 23:43:21 PST 2012


After radeontool-1.6.0~28 ("add more ram dumping stuff") avivotool
tries to detect a Radeon unconditionally, even for the romtables
subcommand that doesn't require one.  To keep avivotool useful when
there is an error detecting a card, the patch changed the fatal error
codepath to keep going rather than exiting.

That had some unpleasant side effects, so make lack of a card and
other card detection trouble into non-fatal errors as preparation for
making die() exit again.

Signed-off-by: Jonathan Nieder <jrnieder at gmail.com>
---
 avivotool.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/avivotool.c b/avivotool.c
index 5db63715..4f12d113 100644
--- a/avivotool.c
+++ b/avivotool.c
@@ -1799,8 +1799,10 @@ static int map_radeon_mem(void)
     struct pci_device *device;
     int i = 0;
 
-    if (pci_system_init() != 0)
-        die("failed to initialise libpciaccess");
+    if (pci_system_init() != 0) {
+        fprintf(stderr, "error: failed to initialise libpciaccess\n");
+        return -1;
+    }
 
 #if 0
     match.vendor_id = 0x1002;
@@ -1865,8 +1867,10 @@ static int map_radeon_mem(void)
       return -1;
     }
       
-    if (pci_device_map_region(avivo_device, ctrl_region, 1) != 0)
-        die("mapping ctrl region");
+    if (pci_device_map_region(avivo_device, ctrl_region, 1) != 0) {
+        fprintf(stderr, "error: mapping ctrl region\n");
+        return -1;
+    }
     ctrl_mem = avivo_device->regions[ctrl_region].memory;
 
     if (pci_device_map_region(avivo_device, fb_region, 1) == 0)
-- 
1.7.9.1



More information about the xorg-driver-ati mailing list