diff options
author | Krzysztof Halasa <khc@pm.waw.pl> | 2006-06-22 16:29:28 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-06-22 23:32:03 -0400 |
commit | 4446065a2c9b65398ceb115f4d8c256eb1bb9647 (patch) | |
tree | cdaa04d42876632e0df95054d46851cac6648ce3 /drivers/net | |
parent | 4a31e348e3ecaf54c50240109ac4574b180f8840 (diff) |
[PATCH] WAN: ioremap() failure checks in drivers
Eric Sesterhenn found that pci200syn initialization lacks return
statement in ioremap() error path (coverity bug id #195). It looks
like more WAN drivers have problems with ioremap().
Signed-off-by: Krzysztof Halasa <khc@pm.waw.pl>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wan/c101.c | 6 | ||||
-rw-r--r-- | drivers/net/wan/n2.c | 5 | ||||
-rw-r--r-- | drivers/net/wan/pci200syn.c | 1 | ||||
-rw-r--r-- | drivers/net/wan/wanxl.c | 12 |
4 files changed, 21 insertions, 3 deletions
diff --git a/drivers/net/wan/c101.c b/drivers/net/wan/c101.c index 43d854ace233..b60ef02db7b0 100644 --- a/drivers/net/wan/c101.c +++ b/drivers/net/wan/c101.c | |||
@@ -326,21 +326,21 @@ static int __init c101_run(unsigned long irq, unsigned long winbase) | |||
326 | if (request_irq(irq, sca_intr, 0, devname, card)) { | 326 | if (request_irq(irq, sca_intr, 0, devname, card)) { |
327 | printk(KERN_ERR "c101: could not allocate IRQ\n"); | 327 | printk(KERN_ERR "c101: could not allocate IRQ\n"); |
328 | c101_destroy_card(card); | 328 | c101_destroy_card(card); |
329 | return(-EBUSY); | 329 | return -EBUSY; |
330 | } | 330 | } |
331 | card->irq = irq; | 331 | card->irq = irq; |
332 | 332 | ||
333 | if (!request_mem_region(winbase, C101_MAPPED_RAM_SIZE, devname)) { | 333 | if (!request_mem_region(winbase, C101_MAPPED_RAM_SIZE, devname)) { |
334 | printk(KERN_ERR "c101: could not request RAM window\n"); | 334 | printk(KERN_ERR "c101: could not request RAM window\n"); |
335 | c101_destroy_card(card); | 335 | c101_destroy_card(card); |
336 | return(-EBUSY); | 336 | return -EBUSY; |
337 | } | 337 | } |
338 | card->phy_winbase = winbase; | 338 | card->phy_winbase = winbase; |
339 | card->win0base = ioremap(winbase, C101_MAPPED_RAM_SIZE); | 339 | card->win0base = ioremap(winbase, C101_MAPPED_RAM_SIZE); |
340 | if (!card->win0base) { | 340 | if (!card->win0base) { |
341 | printk(KERN_ERR "c101: could not map I/O address\n"); | 341 | printk(KERN_ERR "c101: could not map I/O address\n"); |
342 | c101_destroy_card(card); | 342 | c101_destroy_card(card); |
343 | return -EBUSY; | 343 | return -EFAULT; |
344 | } | 344 | } |
345 | 345 | ||
346 | card->tx_ring_buffers = TX_RING_BUFFERS; | 346 | card->tx_ring_buffers = TX_RING_BUFFERS; |
diff --git a/drivers/net/wan/n2.c b/drivers/net/wan/n2.c index cd32751b64eb..b7d88db89a5c 100644 --- a/drivers/net/wan/n2.c +++ b/drivers/net/wan/n2.c | |||
@@ -387,6 +387,11 @@ static int __init n2_run(unsigned long io, unsigned long irq, | |||
387 | } | 387 | } |
388 | card->phy_winbase = winbase; | 388 | card->phy_winbase = winbase; |
389 | card->winbase = ioremap(winbase, USE_WINDOWSIZE); | 389 | card->winbase = ioremap(winbase, USE_WINDOWSIZE); |
390 | if (!card->winbase) { | ||
391 | printk(KERN_ERR "n2: ioremap() failed\n"); | ||
392 | n2_destroy_card(card); | ||
393 | return -EFAULT; | ||
394 | } | ||
390 | 395 | ||
391 | outb(0, io + N2_PCR); | 396 | outb(0, io + N2_PCR); |
392 | outb(winbase >> 12, io + N2_BAR); | 397 | outb(winbase >> 12, io + N2_BAR); |
diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c index f485a97844cc..670e8bd2245c 100644 --- a/drivers/net/wan/pci200syn.c +++ b/drivers/net/wan/pci200syn.c | |||
@@ -354,6 +354,7 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev, | |||
354 | card->rambase == NULL) { | 354 | card->rambase == NULL) { |
355 | printk(KERN_ERR "pci200syn: ioremap() failed\n"); | 355 | printk(KERN_ERR "pci200syn: ioremap() failed\n"); |
356 | pci200_pci_remove_one(pdev); | 356 | pci200_pci_remove_one(pdev); |
357 | return -EFAULT; | ||
357 | } | 358 | } |
358 | 359 | ||
359 | /* Reset PLX */ | 360 | /* Reset PLX */ |
diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c index 29a756dd979b..437e0e938e38 100644 --- a/drivers/net/wan/wanxl.c +++ b/drivers/net/wan/wanxl.c | |||
@@ -634,7 +634,13 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, | |||
634 | 634 | ||
635 | /* set up PLX mapping */ | 635 | /* set up PLX mapping */ |
636 | plx_phy = pci_resource_start(pdev, 0); | 636 | plx_phy = pci_resource_start(pdev, 0); |
637 | |||
637 | card->plx = ioremap_nocache(plx_phy, 0x70); | 638 | card->plx = ioremap_nocache(plx_phy, 0x70); |
639 | if (!card->plx) { | ||
640 | printk(KERN_ERR "wanxl: ioremap() failed\n"); | ||
641 | wanxl_pci_remove_one(pdev); | ||
642 | return -EFAULT; | ||
643 | } | ||
638 | 644 | ||
639 | #if RESET_WHILE_LOADING | 645 | #if RESET_WHILE_LOADING |
640 | wanxl_reset(card); | 646 | wanxl_reset(card); |
@@ -700,6 +706,12 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, | |||
700 | } | 706 | } |
701 | 707 | ||
702 | mem = ioremap_nocache(mem_phy, PDM_OFFSET + sizeof(firmware)); | 708 | mem = ioremap_nocache(mem_phy, PDM_OFFSET + sizeof(firmware)); |
709 | if (!mem) { | ||
710 | printk(KERN_ERR "wanxl: ioremap() failed\n"); | ||
711 | wanxl_pci_remove_one(pdev); | ||
712 | return -EFAULT; | ||
713 | } | ||
714 | |||
703 | for (i = 0; i < sizeof(firmware); i += 4) | 715 | for (i = 0; i < sizeof(firmware); i += 4) |
704 | writel(htonl(*(u32*)(firmware + i)), mem + PDM_OFFSET + i); | 716 | writel(htonl(*(u32*)(firmware + i)), mem + PDM_OFFSET + i); |
705 | 717 | ||