mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <pazke@orbita1.ru>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] lp486e.c: check region removal
Date: Fri, 25 May 2001 11:13:13 +0400	[thread overview]
Message-ID: <20010525111313.B18389@orbita1.ru> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 296 bytes --]

Hi all,

patch for lp486e.c network driver attached. 
Changes: check_region() call removed, added missing __init and __exit.

Best regards.

-- 
Andrey Panin            | Embedded systems software engineer
pazke@orbita1.ru        | PGP key: http://www.orbita1.ru/~pazke/AndreyPanin.asc

[-- Attachment #1.2: patch-lp486e-2 --]
[-- Type: text/plain, Size: 2173 bytes --]

diff -ur -X /usr/dontdiff linux.vanilla/drivers/net/lp486e.c /linux/drivers/net/lp486e.c
--- linux.vanilla/drivers/net/lp486e.c	Mon May 21 23:49:44 2001
+++ /linux/drivers/net/lp486e.c	Fri May 25 22:23:22 2001
@@ -971,16 +971,17 @@
 	volatile struct i596_private *lp;
 	unsigned char eth_addr[6] = { 0, 0xaa, 0, 0, 0, 0 };
 	unsigned char *bios;
-	int i,j;
-	static int probed = 0;
+	int i, j;
+	int ret = -ENOMEM;
+	static int probed;
 
 	if (probed)
 		return -ENODEV;
 	probed++;
 
-	if (check_region(IOADDR, LP486E_TOTAL_SIZE)) {
-		printk("lp486e: IO address 0x%x in use\n", IOADDR);
-		return -ENODEV;
+	if (!request_region(IOADDR, LP486E_TOTAL_SIZE, dev->name)) {
+		printk(KERN_ERR "lp486e: IO address 0x%x in use\n", IOADDR);
+		return -EBUSY;
 	}
 
 	/*
@@ -989,7 +990,7 @@
 	dev->mem_start = (unsigned long)
 		kmalloc(sizeof(struct i596_private) + 0x0f, GFP_KERNEL);
 	if (!dev->mem_start)
-		return -ENOMEM;
+		goto err_out;
 	dev->priv = (void *)((dev->mem_start + 0xf) & 0xfffffff0);
 	lp = (struct i596_private *) dev->priv;
 	memset((void *)lp, 0, sizeof(struct i596_private));
@@ -998,12 +999,10 @@
 	 * Do we really have this thing?
 	 */
 	if (i596_scp_setup(dev)) {
-		kfree ((void *) dev->mem_start);
-		return -ENODEV;
+		ret = -ENODEV;
+		goto err_out_kfree;
 	}
 
-	request_region(IOADDR, LP486E_TOTAL_SIZE, "lp486e");
-
 	dev->base_addr = IOADDR;
 	dev->irq = IRQ;
 
@@ -1053,6 +1052,12 @@
 	i596_port_do(dev, PORT_DUMP, "dump");
 #endif
 	return 0;
+
+err_out_kfree:
+	kfree ((void *) dev->mem_start);
+err_out:
+	release_region(IOADDR, LP486E_TOTAL_SIZE);
+	return ret;
 }
 
 static void inline
@@ -1330,7 +1335,7 @@
 static int io = IOADDR;
 static int irq = IRQ;
 
-static int lp486e_init_module(void) {
+static int __init lp486e_init_module(void) {
 	struct net_device *dev = &dev_lp486e;
 	dev->irq = irq;
 	dev->base_addr = io;
@@ -1342,7 +1347,7 @@
 	return 0;
 }
 
-static void lp486e_cleanup_module(void) {
+static void __exit lp486e_cleanup_module(void) {
 	unregister_netdev(&dev_lp486e);
 	kfree((void *)dev_lp486e.mem_start);
 	dev_lp486e.priv = NULL;

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

                 reply	other threads:[~2001-05-25  7:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20010525111313.B18389@orbita1.ru \
    --to=pazke@orbita1.ru \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®