patch-2.1.131 linux/drivers/video/atyfb.c

Next file: linux/fs/affs/namei.c
Previous file: linux/drivers/sound/sb_common.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.130/linux/drivers/video/atyfb.c linux/drivers/video/atyfb.c
@@ -973,6 +973,11 @@
 #endif
 #endif
 
+	if (! cursor->ram) {
+		kfree(cursor);
+		return NULL;
+	}
+
 	if (curblink) {
 		init_timer(cursor->timer);
 		cursor->timer->expires = jiffies + (HZ / 50);
@@ -2917,6 +2922,11 @@
 	    info->ati_regbase = (unsigned long)
 				ioremap(info->ati_regbase_phys, 0x1000);
 
+	    if(!info->ati_regbase) {
+		    kfree(info);
+		    return;
+	    }
+
 	    info->ati_regbase_phys += 0xc00;
 	    info->ati_regbase += 0xc00;
 
@@ -2939,6 +2949,11 @@
 	    info->frame_buffer_phys = addr;
 	    info->frame_buffer = (unsigned long)ioremap(addr, 0x800000);
 
+	    if(!info->frame_buffer) {
+		    kfree(info);
+		    return;
+	    }
+
 #endif /* __sparc__ */
 
 	    if (!aty_init(info, "PCI")) {
@@ -3046,6 +3061,13 @@
     info->ati_regbase_phys = 0x7ff000+addr;
     info->ati_regbase = (unsigned long)ioremap(info->ati_regbase_phys,
 						   0x1000);
+
+    if(! info->ati_regbase) {
+	    printk("atyfb_init: ioremap() returned NULL\n");
+	    kfree(info);
+	    return;
+    }
+
     info->ati_regbase_phys += 0xc00;
     info->ati_regbase += 0xc00;
 
@@ -3066,6 +3088,12 @@
     /* Map in frame buffer */
     info->frame_buffer_phys = addr;
     info->frame_buffer = (unsigned long)ioremap(addr, 0x800000);
+
+    if(! info->frame_buffer) {
+	    printk("atyfb_init: ioremap() returned NULL\n");
+	    kfree(info);
+	    return;
+    }
 
     if (!aty_init(info, dp->full_name)) {
 	kfree(info);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov