#include <linux/linux_logo.h>
 #include <linux/font.h>
 
+#define NEWPORT_LEN    0x10000
+
 #define FONT_DATA ((unsigned char *)font_vga_8x16.data)
 
 /* borrowed from fbcon.c */
 static unsigned char *font_data[MAX_NR_CONSOLES];
 
 static struct newport_regs *npregs;
+static unsigned long newport_addr;
 
 static int logo_active;
 static int topscan;
 static int newport_probe(struct gio_device *dev,
                         const struct gio_device_id *id)
 {
-       unsigned long newport_addr;
        int err;
 
        if (!dev->resource.start)
                return -EBUSY; /* we only support one Newport as console */
 
        newport_addr = dev->resource.start + 0xF0000;
-       if (!request_mem_region(newport_addr, 0x10000, "Newport"))
+       if (!request_mem_region(newport_addr, NEWPORT_LEN, "Newport"))
                return -ENODEV;
 
        npregs = (struct newport_regs *)/* ioremap cannot fail */
        console_lock();
        err = do_take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1);
        console_unlock();
+
+       if (err) {
+               iounmap((void *)npregs);
+               release_mem_region(newport_addr, NEWPORT_LEN);
+       }
        return err;
 }
 
 {
        give_up_console(&newport_con);
        iounmap((void *)npregs);
+       release_mem_region(newport_addr, NEWPORT_LEN);
 }
 
 static struct gio_device_id newport_ids[] = {