Do not blithely use an uninitialized value when the expected memory areas cannot be found.
This is triggered by trying to use radeontool on an r128. Noticed-by: Tormod Volden <debian.tor...@gmail.com> Signed-off-by: Jonathan Nieder <jrnie...@gmail.com> Acked-by: Tormod Volden <debian.tor...@gmail.com> --- radeontool.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/radeontool.c b/radeontool.c index ab5c76e..7fd1010 100644 --- a/radeontool.c +++ b/radeontool.c @@ -33,7 +33,7 @@ int skip = 0; /* Not the address but what it points to is volatile. */ struct pci_device *avivo_device = NULL; unsigned char * volatile radeon_cntl_mem; -unsigned int ctrl_region, fb_region; +int ctrl_region = -1, fb_region = -1; unsigned char * volatile fb_mem; unsigned char * volatile ctrl_mem; static void radeon_rom_legacy_mmio_table(unsigned char *bios, int offset); @@ -882,7 +882,7 @@ void radeon_cmd_stretch(char *param) } -/* Here we fork() and exec() the lspci command to look for the Radeon hardware address. */ +/* Look for the Radeon hardware address. */ static void map_radeon_cntl_mem(void) { struct pci_slot_match match; @@ -919,6 +919,10 @@ static void map_radeon_cntl_mem(void) else if (device->regions[i].size >= 128 * 1024 * 1024) fb_region = i; } + if (ctrl_region == -1) + fatal("cannot find ctrl region\n"); + if (fb_region == -1) + fatal("cannot find fb region\n"); avivo_device = device; break; } -- 1.7.0.3 _______________________________________________ xorg-driver-ati mailing list xorg-driver-ati@lists.x.org http://lists.x.org/mailman/listinfo/xorg-driver-ati