From: Christoph Hellwig <hch@infradead.org>
To: Christoph Hellwig <hch@infradead.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
Jeff Garzik <jgarzik@pobox.com>,
Linux Kernel Development <linux-kernel@vger.kernel.org>,
linux-net@vger.kernel.org
Subject: Re: [PATCH 475] HP300 LANCE
Date: Tue, 16 Nov 2004 08:43:41 +0000 [thread overview]
Message-ID: <20041116084341.GA24484@infradead.org> (raw)
In-Reply-To: <20041101142245.GA28253@infradead.org>
On Mon, Nov 01, 2004 at 02:22:45PM +0000, Christoph Hellwig wrote:
> On Sun, Oct 31, 2004 at 11:03:30AM +0100, Geert Uytterhoeven wrote:
> > HP300 LANCE updates from Kars de Jong:
> > - Updated HP LANCE driver to use the new DIO semantics
> > - If only HP LANCE or MVME147 LANCE is selected, enable compile-time
> > choice of LANCE register access. If both are defined, go through the
> > function pointer
> > - Added support for CONFIG_NET_POLL_CONTROLLER
> > - Fixed problem with disabling board interrupts in hplance_close() which
> > caused the driver to lock up
>
> There's tons of leaks in the hplcance probing code, and it doesn't release
> he memory region on removal either.
>
> Untested patch to fix those issues below:
ping.
--- 1.12/drivers/net/hplance.c 2004-10-06 22:44:40 +02:00
+++ edited/drivers/net/hplance.c 2004-11-01 10:20:17 +01:00
@@ -71,30 +71,42 @@
.remove = __devexit_p(hplance_remove_one),
};
+/* XXX(hch): should probably move to a better place */
+#define dio_resource_start(d) \
+ ((d)->resource.start)
+#define dio_resource_len(d) \
+ ((d)->resource.end - (d)->resource.start)
+
/* Find all the HP Lance boards and initialise them... */
static int __devinit hplance_init_one(struct dio_dev *d,
const struct dio_device_id *ent)
{
struct net_device *dev;
- int err;
+ int err = -ENOMEM;
dev = alloc_etherdev(sizeof(struct hplance_private));
if (!dev)
- return -ENOMEM;
+ goto out;
- if (!request_mem_region(d->resource.start, d->resource.end-d->resource.start, d->name))
- return -EBUSY;
+ err = -EBUSY;
+ if (!request_mem_region(dio_resource_start(d),
+ dio_resource_len(d), d->name))
+ goto out_free_netdev;
- SET_MODULE_OWNER(dev);
-
hplance_init(dev, d);
err = register_netdev(dev);
- if (err) {
- free_netdev(dev);
- return err;
- }
+ if (err)
+ goto out_free_netdev;
+
dio_set_drvdata(d, dev);
return 0;
+
+ out_release_mem_region:
+ release_mem_region(dio_resource_start(d), dio_resource_len(d));
+ out_free_netdev:
+ free_netdev(dev);
+ out:
+ return err;
}
static void __devexit hplance_remove_one(struct dio_dev *d)
@@ -102,6 +114,7 @@
struct net_device *dev = dio_get_drvdata(d);
unregister_netdev(dev);
+ release_mem_region(dio_resource_start(d), dio_resource_len(d));
free_netdev(dev);
}
next prev parent reply other threads:[~2004-11-16 8:44 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-31 10:03 [PATCH 475] HP300 LANCE Geert Uytterhoeven
2004-10-31 10:14 ` Jeff Garzik
2004-10-31 10:19 ` Andrew Morton
2004-10-31 10:41 ` Jeff Garzik
2004-10-31 10:48 ` Andrew Morton
2004-10-31 10:57 ` Jeff Garzik
2004-10-31 11:09 ` Andrew Morton
2004-10-31 11:44 ` Geert Uytterhoeven
2004-10-31 11:50 ` Herbert Xu
2004-10-31 11:58 ` Jeff Garzik
2004-11-01 14:22 ` Christoph Hellwig
2004-11-16 8:43 ` Christoph Hellwig [this message]
2004-11-17 7:12 ` Andrew Morton
2004-11-21 10:01 ` Geert Uytterhoeven
2004-11-21 11:19 ` Kars de Jong
2004-11-22 0:12 ` Andrew Morton
2004-11-22 0:25 ` Sohail Somani
2004-11-22 10:54 ` Geert Uytterhoeven
2004-11-22 8:26 ` Geert Uytterhoeven
-- strict thread matches above, loose matches on Subject: below --
2004-11-01 3:46 Chuck Ebbert
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=20041116084341.GA24484@infradead.org \
--to=hch@infradead.org \
--cc=akpm@osdl.org \
--cc=geert@linux-m68k.org \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-net@vger.kernel.org \
--cc=torvalds@osdl.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