diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2010-03-23 21:52:19 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-03-24 13:16:07 +1000 |
commit | 7e3e9808cc1e47be3a2d26cd507aef1ba6d508be (patch) | |
tree | e0b80122c849f3768c8e73c7596def9d38abec15 /radeontool.c | |
parent | a8ce2f23c5898c701f7ec0a8a7bb823081a29317 (diff) |
radeontool: error out for missing control or fb region
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.tormod@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Tormod Volden <debian.tormod@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'radeontool.c')
-rw-r--r-- | radeontool.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/radeontool.c b/radeontool.c index 03b9f8d..d8622d5 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; } |