All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe W Damasio <felipewd@terra.com.br>
To: Jeff Garzik <jgarzik@pobox.com>, cgoos@syskonnect.de
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux@syskonnect.de
Subject: [PATCH] release region in skfddi driver
Date: Mon, 06 Oct 2003 10:14:30 -0300	[thread overview]
Message-ID: <3F816AB6.6020709@terra.com.br> (raw)

[-- 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);
 	}

             reply	other threads:[~2003-10-06 13:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-06 13:14 Felipe W Damasio [this message]
2003-10-14 18:22 ` [PATCH] release region in skfddi driver Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F816AB6.6020709@terra.com.br \
    --to=felipewd@terra.com.br \
    --cc=cgoos@syskonnect.de \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@syskonnect.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.