diff options
Diffstat (limited to 'drivers/video/uvesafb.c')
-rw-r--r-- | drivers/video/uvesafb.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index e7f69ef572dc..1f882ed6ba04 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c @@ -23,6 +23,7 @@ #include <video/uvesafb.h> #ifdef CONFIG_X86 #include <video/vga.h> +#include <linux/pci.h> #endif #ifdef CONFIG_MTRR #include <asm/mtrr.h> @@ -362,7 +363,7 @@ static u8 *uvesafb_vbe_state_save(struct uvesafb_par *par) state = kmalloc(par->vbe_state_size, GFP_KERNEL); if (!state) - return NULL; + return ERR_PTR(-ENOMEM); task = uvesafb_prep(); if (!task) { @@ -815,8 +816,15 @@ static int __devinit uvesafb_vbe_init(struct fb_info *info) par->pmi_setpal = pmi_setpal; par->ypan = ypan; - if (par->pmi_setpal || par->ypan) - uvesafb_vbe_getpmi(task, par); + if (par->pmi_setpal || par->ypan) { + if (pcibios_enabled) { + uvesafb_vbe_getpmi(task, par); + } else { + par->pmi_setpal = par->ypan = 0; + printk(KERN_WARNING "uvesafb: PCI BIOS area is NX." + "Can't use protected mode interface\n"); + } + } #else /* The protected mode interface is not available on non-x86. */ par->pmi_setpal = par->ypan = 0; @@ -1172,9 +1180,17 @@ static int uvesafb_open(struct fb_info *info, int user) { struct uvesafb_par *par = info->par; int cnt = atomic_read(&par->ref_count); + u8 *buf = NULL; - if (!cnt && par->vbe_state_size) - par->vbe_state_orig = uvesafb_vbe_state_save(par); + if (!cnt && par->vbe_state_size) { + buf = uvesafb_vbe_state_save(par); + if (IS_ERR(buf)) { + printk(KERN_WARNING "uvesafb: save hardware state" + "failed, error code is %ld!\n", PTR_ERR(buf)); + } else { + par->vbe_state_orig = buf; + } + } atomic_inc(&par->ref_count); return 0; |