public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] release region in skfddi driver
@ 2003-10-06 13:14 Felipe W Damasio
  2003-10-14 18:22 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: Felipe W Damasio @ 2003-10-06 13:14 UTC (permalink / raw)
  To: Jeff Garzik, cgoos; +Cc: Linux Kernel Mailing List, linux

[-- Attachment #1: Type: text/plain, Size: 308 bytes --]

	Hi Jeff/Christoph,

	Patch against 2.6.0-test6.

	- Check the return value of request_region;

	- Only increment the global adapter value if request_region returned 
a valid pointer;

	- release_region if global adapter value > 0;

	Found by smatch.

	Please review and consider applying,

	Cheers.

Felipe

[-- Attachment #2: skfddi-region.patch --]
[-- Type: text/plain, Size: 1051 bytes --]

--- linux-2.6.0-test6/drivers/net/skfp/skfddi.c.orig	2003-10-06 09:47:16.000000000 -0300
+++ linux-2.6.0-test6/drivers/net/skfp/skfddi.c	2003-10-06 10:03:14.000000000 -0300
@@ -394,11 +394,15 @@
 			skb_queue_head_init(&smc->os.SendSkbQueue);
 
 			if (skfp_driver_init(dev) == 0) {
+				if (!request_region(dev->base_addr,
+					       FP_IO_LEN, dev->name)){
+					kfree (dev);
+					return -EBUSY;
+				}
+
 				// only increment global board 
 				// count on success
 				num_boards++;
-				request_region(dev->base_addr,
-					       FP_IO_LEN, dev->name);
 				if ((SubSysId & 0xff00) == 0x5500 ||
 					(SubSysId & 0xff00) == 0x5800) {
 				printk("%s: SysKonnect FDDI PCI adapter"
@@ -411,11 +415,8 @@
 			} else {
 				kfree(dev);
 				i = SKFP_MAX_NUM_BOARDS;	// stop search
-
 			}
-
 		}		// if (dev != NULL)
-
 	}			// for SKFP_MAX_NUM_BOARDS
 
 	/*
@@ -427,6 +428,7 @@
 	if (num_boards > 0)
 		return (0);
 	else {
+		release_region (dev->base_addr, FP_IO_LEN);
 		printk("no SysKonnect FDDI adapter found\n");
 		return (-ENODEV);
 	}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-10-14 18:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-06 13:14 [PATCH] release region in skfddi driver Felipe W Damasio
2003-10-14 18:22 ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox