bcma: Move initialization of SPROM to prevent overwrite
authorNathan Hintz <nlhintz@hotmail.com>
Sat, 5 May 2012 04:56:32 +0000 (21:56 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 16 May 2012 16:46:03 +0000 (12:46 -0400)
The first thing bcm47xx_fill_sprom does is initialize (zero fill) the SPROM.  For
BCMA SOC, this wipes out any values previously read by bcm47xx_fill_sprom_ethernet
(see arch/mips/bcm47xx/setup.c - bcm47xx_get_sprom_bcma).  Move the initialization
of SPROM so it is called prior to filling in any values.

Signed-off-by: Nathan Hintz <nlhintz@hotmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
arch/mips/bcm47xx/setup.c
arch/mips/bcm47xx/sprom.c

index 9ef46d2..95bf4d7 100644 (file)
@@ -90,6 +90,7 @@ static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out)
        char prefix[10];
 
        if (bus->bustype == SSB_BUSTYPE_PCI) {
+               memset(out, 0, sizeof(struct ssb_sprom));
                snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
                         bus->host_pci->bus->number + 1,
                         PCI_SLOT(bus->host_pci->devfn));
@@ -111,6 +112,7 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
 
        bcm47xx_fill_ssb_boardinfo(&iv->boardinfo, NULL);
 
+       memset(&iv->sprom, 0, sizeof(struct ssb_sprom));
        bcm47xx_fill_sprom(&iv->sprom, NULL);
 
        if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0)
@@ -159,12 +161,14 @@ static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out)
 
        switch (bus->hosttype) {
        case BCMA_HOSTTYPE_PCI:
+               memset(out, 0, sizeof(struct ssb_sprom));
                snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
                         bus->host_pci->bus->number + 1,
                         PCI_SLOT(bus->host_pci->devfn));
                bcm47xx_fill_sprom(out, prefix);
                return 0;
        case BCMA_HOSTTYPE_SOC:
+               memset(out, 0, sizeof(struct ssb_sprom));
                bcm47xx_fill_sprom_ethernet(out, NULL);
                core = bcma_find_core(bus, BCMA_CORE_80211);
                if (core) {
index 17282e0..d3a8897 100644 (file)
@@ -557,8 +557,6 @@ void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix)
 
 void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
 {
-       memset(sprom, 0, sizeof(struct ssb_sprom));
-
        bcm47xx_fill_sprom_ethernet(sprom, prefix);
 
        nvram_read_u8(prefix, NULL, "sromrev", &sprom->revision, 0);