patch-2.4.20 linux-2.4.20/drivers/net/hamradio/yam.c

Next file: linux-2.4.20/drivers/net/hp-plus.c
Previous file: linux-2.4.20/drivers/net/hamradio/soundmodem/sm_wss.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.19/drivers/net/hamradio/yam.c linux-2.4.20/drivers/net/hamradio/yam.c
@@ -840,6 +840,7 @@
 	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);
 
@@ -849,24 +850,27 @@
 		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);
 
@@ -883,6 +887,10 @@
 	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;
 }
 
 /* --------------------------------------------------------------------- */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)