]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
bcma: add check if sprom is available before accessing it.
authorHauke Mehrtens <hauke@hauke-m.de>
Sat, 9 Jul 2011 11:22:03 +0000 (13:22 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 11 Jul 2011 19:02:17 +0000 (15:02 -0400)
The SoCs like the bcm4716 do not have a sprom on the bcma bus like a
pcie device. It stores the values in some partition on flash memory.
For ssb this informations are read out in the bcm47xx arch code,
something like that should also be implemented for bcma. Without this
patch bcma panics on SoCs.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/bcma/main.c
drivers/bcma/sprom.c

index 08a14a3d667ed6a796603cd94a3166ce70e8b5de..873e2e4ac55f01795a3b174b103ce0960c484bc2 100644 (file)
@@ -149,7 +149,9 @@ int bcma_bus_register(struct bcma_bus *bus)
 
        /* Try to get SPROM */
        err = bcma_sprom_get(bus);
-       if (err) {
+       if (err == -ENOENT) {
+               pr_err("No SPROM available\n");
+       } else if (err) {
                pr_err("Failed to get SPROM: %d\n", err);
                return -ENOENT;
        }
index ffbb0e32e9216bc9985700ca71a8ee3d80a6eeee..8e8d5cf32e12fd938c62c3d98a5f57356aa2b5a1 100644 (file)
@@ -143,6 +143,9 @@ int bcma_sprom_get(struct bcma_bus *bus)
        if (!bus->drv_cc.core)
                return -EOPNOTSUPP;
 
+       if (!(bus->drv_cc.capabilities & BCMA_CC_CAP_SPROM))
+               return -ENOENT;
+
        sprom = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16),
                        GFP_KERNEL);
        if (!sprom)