patch-2.4.19 linux-2.4.19/drivers/char/logibusmouse.c

Next file: linux-2.4.19/drivers/char/lp.c
Previous file: linux-2.4.19/drivers/char/lcd.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.18/drivers/char/logibusmouse.c linux-2.4.19/drivers/char/logibusmouse.c
@@ -128,25 +128,28 @@
 
 static int __init logi_busmouse_init(void)
 {
-	if (check_region(LOGIBM_BASE, LOGIBM_EXTENT))
+	if (!request_region(LOGIBM_BASE, LOGIBM_EXTENT, "busmouse"))
 		return -EIO;
 
 	outb(MSE_CONFIG_BYTE, MSE_CONFIG_PORT);
 	outb(MSE_SIGNATURE_BYTE, MSE_SIGNATURE_PORT);
 	udelay(100L);	/* wait for reply from mouse */
-	if (inb(MSE_SIGNATURE_PORT) != MSE_SIGNATURE_BYTE)
+	if (inb(MSE_SIGNATURE_PORT) != MSE_SIGNATURE_BYTE) {
+		release_region(LOGIBM_BASE, LOGIBM_EXTENT);
 		return -EIO;
+	}
 
 	outb(MSE_DEFAULT_MODE, MSE_CONFIG_PORT);
 	MSE_INT_OFF();
 	
-	request_region(LOGIBM_BASE, LOGIBM_EXTENT, "busmouse");
-
 	msedev = register_busmouse(&busmouse);
-	if (msedev < 0)
+	if (msedev < 0) {
+		release_region(LOGIBM_BASE, LOGIBM_EXTENT);
 		printk(KERN_WARNING "Unable to register busmouse driver.\n");
+	} 
 	else
 		printk(KERN_INFO "Logitech busmouse installed.\n");
+	
 	return msedev < 0 ? msedev : 0;
 }
 

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