mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: davej@codemonkey.org.uk
To: jgarzik@pobox.com
Cc: linux-kernel@vger.kernel.org
Subject: init_etherdev conversion for sb1000
Date: Mon, 24 Mar 2003 16:41:49 +0000	[thread overview]
Message-ID: <200303241642.h2OGg235008237@deviant.impure.org.uk> (raw)

Also plugs leak by kfree'ing dev_sb1000 on exit.

diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/net/sb1000.c linux-2.5/drivers/net/sb1000.c
--- bk-linus/drivers/net/sb1000.c	2003-03-08 09:57:16.000000000 +0000
+++ linux-2.5/drivers/net/sb1000.c	2003-03-17 23:42:27.000000000 +0000
@@ -218,7 +218,7 @@ sb1000_probe(struct net_device *dev)
 				"S/N %#8.8x, IRQ %d.\n", dev->name, dev->base_addr,
 				dev->mem_start, serial_number, dev->irq);
 
-		dev = init_etherdev(dev, 0);
+		dev = init_etherdev(dev, sizeof(struct sb1000_private));
 		if (!dev) {
 			pnp_device_detach(idev);
 			release_region(ioaddr[1], 16);
@@ -227,12 +227,6 @@ sb1000_probe(struct net_device *dev)
 		}
 		SET_MODULE_OWNER(dev);
 
-		/* Make up a SB1000-specific-data structure. */
-		dev->priv = kmalloc(sizeof(struct sb1000_private), GFP_KERNEL);
-		if (dev->priv == NULL)
-			return -ENOMEM;
-		memset(dev->priv, 0, sizeof(struct sb1000_private));
-
 		if (sb1000_debug > 0)
 			printk(KERN_NOTICE "%s", version);
 
@@ -1251,8 +1245,7 @@ void cleanup_module(void)
 	unregister_netdev(&dev_sb1000);
 	release_region(dev_sb1000.base_addr, 16);
 	release_region(dev_sb1000.mem_start, 16);
-	kfree(dev_sb1000.priv);
-	dev_sb1000.priv = NULL;
+	kfree(dev_sb1000);
 }
 #endif /* MODULE */
 \f

             reply	other threads:[~2003-03-24 16:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-24 16:41 davej [this message]
2003-03-29  5:10 ` 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=200303241642.h2OGg235008237@deviant.impure.org.uk \
    --to=davej@codemonkey.org.uk \
    --cc=jgarzik@pobox.com \
    --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®