All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: John Linville <linville@tuxdriver.com>
Cc: netdev@vger.kernel.org,
	Maximilian Engelhardt <maxi@daemonizer.de>,
	Gary Zambrano <zambrano@broadcom.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: b44-ssb: Fix an invalid pointer casting
Date: Mon, 28 May 2007 00:32:07 +0200	[thread overview]
Message-ID: <200705280032.07365.mb@bu3sch.de> (raw)

This fixes a bug introduced by me with the ssb porting.
A u32 integer is casted to a u16* pointer, which
is gonna break, obviously.

Signed-off-by: Michael Buesch <mb@bu3sch.de>

Index: bu3sch-wireless-dev/drivers/net/b44.c
===================================================================
--- bu3sch-wireless-dev.orig/drivers/net/b44.c	2007-05-28 00:30:00.000000000 +0200
+++ bu3sch-wireless-dev/drivers/net/b44.c	2007-05-28 00:31:32.000000000 +0200
@@ -1568,6 +1568,22 @@ static void b44_setup_pseudo_magicp(stru
 
 }
 
+#ifdef CONFIG_B44_PCI
+static void b44_setup_wol_pci(struct b44 *bp)
+{
+	u16 val;
+
+	if (bp->sdev->bus->bustype != SSB_BUSTYPE_SSB) {
+		val = br32(bp, SSB_TMSLOW);
+		bw32(bp, SSB_TMSLOW, val | SSB_TMSLOW_PE);
+		pci_read_config_word(bp->sdev->bus->host_pci, SSB_PMCSR, &val);
+		pci_write_config_word(bp->sdev->bus->host_pci, SSB_PMCSR, val | SSB_PE);
+	}
+}
+#else
+static inline void b44_setup_wol_pci(struct b44 *bp) { }
+#endif /* CONFIG_B44_PCI */
+
 static void b44_setup_wol(struct b44 *bp)
 {
 	u32 val;
@@ -1594,15 +1610,7 @@ static void b44_setup_wol(struct b44 *bp
  	} else {
  		b44_setup_pseudo_magicp(bp);
  	}
-
-#ifdef CONFIG_B44_PCI
-	if (bp->sdev->bus->bustype != SSB_BUSTYPE_SSB) {
-		val = br32(bp, SSB_TMSLOW);
-		bw32(bp, SSB_TMSLOW, val | SSB_TMSLOW_PE);
-	}
-	pci_read_config_word(bp->sdev->bus->host_pci, SSB_PMCSR, (u16 *)(&val));
-	pci_write_config_word(bp->sdev->bus->host_pci, SSB_PMCSR, val | SSB_PE);
-#endif /* CONFIG_B44_PCI */
+	b44_setup_wol_pci(bp);
 }
 
 static int b44_close(struct net_device *dev)


-- 
Greetings Michael.

                 reply	other threads:[~2007-05-27 22:34 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=200705280032.07365.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=akpm@linux-foundation.org \
    --cc=linville@tuxdriver.com \
    --cc=maxi@daemonizer.de \
    --cc=netdev@vger.kernel.org \
    --cc=zambrano@broadcom.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 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.