From bc6932bb4a25ced97c4f201874573e6097237b78 Mon Sep 17 00:00:00 2001 From: Florian Tobias Schandinat Date: Tue, 22 Sep 2009 16:47:15 -0700 Subject: viafb: fix ioremap_nocache error handling Correct the returned error code for remapping the video framebuffer. Introduce error handling for remapping MMIO register address space to avoid a NULL pointer dereference. Disable hardware acceleration if remapping MMIO register address space failed as those registers are only used for hardware acceleration. Signed-off-by: Florian Tobias Schandinat Cc: Scott Fang Cc: Joseph Chan Cc: Harald Welte Cc: Jonathan Corbet Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/via/viafbdev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index 743eed48a5f7..72759b620e7f 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c @@ -2134,12 +2134,16 @@ static int __devinit via_pci_probe(void) if (!viaparinfo->fbmem_virt) { printk(KERN_INFO "ioremap failed\n"); - return -1; + return -ENOMEM; } viafb_get_mmio_info(&viaparinfo->mmio_base, &viaparinfo->mmio_len); viaparinfo->io_virt = ioremap_nocache(viaparinfo->mmio_base, viaparinfo->mmio_len); + if (!viaparinfo->io_virt) { + printk(KERN_WARNING "ioremap failed: hardware acceleration disabled\n"); + viafb_accel = 0; + } viafbinfo->node = 0; viafbinfo->fbops = &viafb_ops; -- cgit v1.2.3