[PATCH] drivers/cdrom/isp16.c check_region() fix - take 2

From: Omkhar Arasaratnam
Date: Mon Dec 29 2003 - 17:10:57 EST


Ok,

Thanks to all for pointing out my "kernel newbie" mistakes. Here is a new patch, let me know what you think.

Feel free to flame me if I _still_ don't get it :)


--- linux-clean/drivers/cdrom/isp16.c.org 2003-12-29 16:47:34.000000000 -0500
+++ linux-clean/drivers/cdrom/isp16.c 2003-12-29 16:47:26.000000000 -0500
@@ -121,14 +121,14 @@
return (0);
}

- if (check_region(ISP16_IO_BASE, ISP16_IO_SIZE)) {
+ if (!request_region(ISP16_IO_BASE, ISP16_IO_SIZE,"isp16")) {
printk("ISP16: i/o ports already in use.\n");
return (-EIO);
}

if ((isp16_type = isp16_detect()) < 0) {
printk("ISP16: no cdrom interface found.\n");
- return (-EIO);
+ goto out;
}

printk(KERN_INFO
@@ -148,20 +148,23 @@
else {
printk("ISP16: %s not supported by cdrom interface.\n",
isp16_cdrom_type);
- return (-EIO);
+ goto out;
}

if (isp16_cdi_config(isp16_cdrom_base, expected_drive,
isp16_cdrom_irq, isp16_cdrom_dma) < 0) {
printk
("ISP16: cdrom interface has not been properly configured.\n");
- return (-EIO);
+ goto out;
}
printk(KERN_INFO
"ISP16: cdrom interface set up with io base 0x%03X, irq %d, dma %d,"
" type %s.\n", isp16_cdrom_base, isp16_cdrom_irq,
isp16_cdrom_dma, isp16_cdrom_type);
return (0);
+:out
+ release_region(ISP16_IO_BASE, ISP16_IO_SIZE);
+ return (-EIO);
}

static short __init isp16_detect(void)


O
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/