]> err.no Git - linux-2.6/blobdiff - drivers/net/wan/wanxl.c
[PATCH] WAN: ioremap() failure checks in drivers
[linux-2.6] / drivers / net / wan / wanxl.c
index 29a756dd979b4e72e1126f9f65d96c6af856e4a4..437e0e938e38ba7c0239d4a7e9c6b732faa742fc 100644 (file)
@@ -634,7 +634,13 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
 
        /* set up PLX mapping */
        plx_phy = pci_resource_start(pdev, 0);
+
        card->plx = ioremap_nocache(plx_phy, 0x70);
+       if (!card->plx) {
+               printk(KERN_ERR "wanxl: ioremap() failed\n");
+               wanxl_pci_remove_one(pdev);
+               return -EFAULT;
+       }
 
 #if RESET_WHILE_LOADING
        wanxl_reset(card);
@@ -700,6 +706,12 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
        }
 
        mem = ioremap_nocache(mem_phy, PDM_OFFSET + sizeof(firmware));
+       if (!mem) {
+               printk(KERN_ERR "wanxl: ioremap() failed\n");
+               wanxl_pci_remove_one(pdev);
+               return -EFAULT;
+       }
+
        for (i = 0; i < sizeof(firmware); i += 4)
                writel(htonl(*(u32*)(firmware + i)), mem + PDM_OFFSET + i);