Skip to content

Commit

Permalink
viafb: fix ioremap_nocache error handling
Browse files Browse the repository at this point in the history
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 <FlorianSchandinat@gmx.de>
Cc: Scott Fang <ScottFang@viatech.com.cn>
Cc: Joseph Chan <JosephChan@via.com.tw>
Cc: Harald Welte <laforge@gnumonks.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Florian Tobias Schandinat authored and Linus Torvalds committed Sep 23, 2009
1 parent 09cf118 commit bc6932b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/video/via/viafbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bc6932b

Please sign in to comment.