Commit 96a08edb authored by Dave Jones's avatar Dave Jones Committed by Jeff Garzik

net driver janitor fixes:

* region resource handling
* do-while macro definitions
* error cleanup
parent bfda5177
No related merge requests found
......@@ -465,7 +465,7 @@ static int __init at1700_probe1(struct net_device *dev, int ioaddr)
#define EE_DATA_READ 0x80 /* EEPROM chip data out, in reg. 17. */
/* Delay between EEPROM clock transitions. */
#define eeprom_delay() do {} while (0);
#define eeprom_delay() do { } while (0)
/* The EEPROM commands include the alway-set leading bit. */
#define EE_WRITE_CMD (5 << 6)
......
......@@ -383,7 +383,7 @@ int __init lance_probe(struct net_device *dev)
return 0;
}
}
release_resource(r);
release_region(ioaddr, LANCE_TOTAL_SIZE);
}
}
return -ENODEV;
......
......@@ -511,7 +511,6 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared,
struct pci_dev *pdev)
{
struct pcnet32_private *lp;
struct resource *res;
dma_addr_t lp_dma_addr;
int i, media;
int fdx, mii, fset, dxsuflo, ltint;
......@@ -689,13 +688,12 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared,
}
dev->base_addr = ioaddr;
res = request_region(ioaddr, PCNET32_TOTAL_SIZE, chipname);
if (!res)
if (request_region(ioaddr, PCNET32_TOTAL_SIZE, chipname) == NULL)
return -EBUSY;
/* pci_alloc_consistent returns page-aligned memory, so we do not have to check the alignment */
if ((lp = pci_alloc_consistent(pdev, sizeof(*lp), &lp_dma_addr)) == NULL) {
release_resource(res);
release_region(ioaddr, PCNET32_TOTAL_SIZE);
return -ENOMEM;
}
......@@ -727,7 +725,7 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared,
if (!a) {
printk(KERN_ERR PFX "No access methods\n");
pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr);
release_resource(res);
release_region(ioaddr, PCNET32_TOTAL_SIZE);
return -ENODEV;
}
lp->a = *a;
......@@ -775,7 +773,7 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared,
else {
printk(", failed to detect IRQ line.\n");
pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr);
release_resource(res);
release_region(ioaddr, PCNET32_TOTAL_SIZE);
return -ENODEV;
}
}
......
......@@ -154,12 +154,10 @@ static int LOCOMX_open(struct net_device *dev)
return -ENODEV;
}
if (check_region(dev->base_addr, hw->io_extent)) {
if (!request_region(dev->base_addr, hw->io_extent, dev->name)) {
return -EAGAIN;
}
request_region(dev->base_addr, hw->io_extent, dev->name);
hw->board.chanA.ctrlio=dev->base_addr + 5;
hw->board.chanA.dataio=dev->base_addr + 7;
......
......@@ -566,8 +566,6 @@ static int MIXCOM_open(struct net_device *dev)
return 0;
err_restore_flags:
restore_flags(flags);
err_release_region:
release_region(dev->base_addr, MIXCOM_IO_EXTENT);
err_ret:
......
......@@ -97,7 +97,7 @@ int __init wd_probe(struct net_device *dev)
return -EBUSY;
i = wd_probe1(dev, base_addr);
if (i != 0)
release_resource(r);
release_region(base_addr, WD_IO_EXTENT);
else
r->name = dev->name;
return i;
......@@ -114,7 +114,7 @@ int __init wd_probe(struct net_device *dev)
r->name = dev->name;
return 0;
}
release_resource(r);
release_region(ioaddr, WD_IO_EXTENT);
}
return -ENODEV;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment