netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Ritz <daniel.ritz@gmx.ch>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@oss.sgi.com
Subject: [PATCH] fix arm/etherh.c
Date: Thu, 1 Apr 2004 23:17:23 +0200	[thread overview]
Message-ID: <200404012317.23719.daniel.ritz@gmx.ch> (raw)

arm/etherh.c was broken when converted to alloc_ei_dev(). fix is the same as
in pcnet_cs.c.

also kfree()ing ec->irqdata is wrong since it's already freed by free_netdev().

against 2.6.5-rc3-bk. untested.


--- 1.21/drivers/net/arm/etherh.c	Wed Mar  3 00:15:42 2004
+++ edited/drivers/net/arm/etherh.c	Sat Mar 27 21:53:49 2004
@@ -59,7 +59,6 @@
 static unsigned int net_debug = NET_DEBUG;
 
 struct etherh_priv {
-	struct ei_device eidev;
 	unsigned int	id;
 	unsigned int	ctrl_port;
 	unsigned int	ctrl;
@@ -99,6 +98,12 @@
 
 /* ------------------------------------------------------------------------ */
 
+static inline struct etherh_priv *PRIV(struct net_device *dev)
+{
+	char *p = netdev_priv(dev);
+	return (struct etherh_priv *)(p + sizeof(struct ei_device));
+}
+
 static inline void etherh_set_ctrl(struct etherh_priv *eh, unsigned int mask)
 {
 	eh->ctrl |= mask;
@@ -144,8 +149,7 @@
 static void
 etherh_setif(struct net_device *dev)
 {
-	struct etherh_priv *eh = netdev_priv(dev);
-	struct ei_device *ei_local = &eh->eidev;
+	struct etherh_priv *eh = PRIV(dev);
 	unsigned long addr, flags;
 
 	local_irq_save(flags);
@@ -188,8 +192,7 @@
 static int
 etherh_getifstat(struct net_device *dev)
 {
-	struct etherh_priv *eh = netdev_priv(dev);
-	struct ei_device *ei_local = &eh->eidev;
+	struct etherh_priv *eh = PRIV(dev);
 	int stat = 0;
 
 	switch (eh->id) {
@@ -551,13 +554,13 @@
 
 	etherh_banner();
 
-	dev = alloc_ei_netdev();
+	dev = __alloc_ei_netdev(sizeof(struct etherh_priv));
 	if (!dev) {
 		ret = -ENOMEM;
 		goto out;
 	}
 
-	eh = netdev_priv(dev);
+	eh = PRIV(dev);
 
 	spin_lock_init(&eh->eidev.page_lock);
 
@@ -712,7 +715,6 @@
 	free_netdev(dev);
 
 	ec->ops = NULL;
-	kfree(ec->irq_data);
 }
 
 static const struct ecard_id etherh_ids[] = {

                 reply	other threads:[~2004-04-01 21:17 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=200404012317.23719.daniel.ritz@gmx.ch \
    --to=daniel.ritz@gmx.ch \
    --cc=jgarzik@pobox.com \
    --cc=netdev@oss.sgi.com \
    /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;
as well as URLs for NNTP newsgroup(s).