Commit 996dec15 authored by William Stinson's avatar William Stinson Committed by Jeff Garzik

[janitor] update the yam hamradio driver to

	- remove call to check_region 
	- check the result of request_region
	- call release_region if something goes wrong afterwards during driver initialisation.

I don't have this hardware so I can't verify if it works (compilation checked only).  
parent 31395026
......@@ -841,6 +841,7 @@ static int yam_open(struct net_device *dev)
struct yam_port *yp = (struct yam_port *) dev->priv;
enum uart u;
int i;
int ret=0;
printk(KERN_INFO "Trying %s at iobase 0x%lx irq %u\n", dev->name, dev->base_addr, dev->irq);
......@@ -850,24 +851,27 @@ static int yam_open(struct net_device *dev)
dev->irq < 2 || dev->irq > 15) {
return -ENXIO;
}
if (check_region(dev->base_addr, YAM_EXTENT)) {
if (!request_region(dev->base_addr, YAM_EXTENT, dev->name))
{
printk(KERN_ERR "%s: cannot 0x%lx busy\n", dev->name, dev->base_addr);
return -EACCES;
}
if ((u = yam_check_uart(dev->base_addr)) == c_uart_unknown) {
printk(KERN_ERR "%s: cannot find uart type\n", dev->name);
return -EIO;
ret = -EIO;
goto out_release_base;
}
if (fpga_download(dev->base_addr, yp->bitrate)) {
printk(KERN_ERR "%s: cannot init FPGA\n", dev->name);
return -EIO;
ret = -EIO;
goto out_release_base;
}
outb(0, IER(dev->base_addr));
if (request_irq(dev->irq, yam_interrupt, SA_INTERRUPT | SA_SHIRQ, dev->name, dev)) {
printk(KERN_ERR "%s: irq %d busy\n", dev->name, dev->irq);
return -EBUSY;
ret = -EBUSY;
goto out_release_base;
}
request_region(dev->base_addr, YAM_EXTENT, dev->name);
yam_set_uart(dev);
......@@ -884,6 +888,10 @@ static int yam_open(struct net_device *dev)
printk(KERN_INFO "%s at iobase 0x%lx irq %u uart %s\n", dev->name, dev->base_addr, dev->irq,
uart_str[u]);
return 0;
out_release_base:
release_region(dev->base_addr, YAM_EXTENT);
return ret;
}
/* --------------------------------------------------------------------- */
......
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