From 534e7a4566ca5fd3c0c92a655bcbaa6f9bd13042 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 9 Jul 2011 13:22:03 +0200 Subject: bcma: add check if sprom is available before accessing it. 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 Signed-off-by: John W. Linville --- drivers/bcma/main.c | 4 +++- drivers/bcma/sprom.c | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'drivers/bcma') diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index 08a14a3d667..873e2e4ac55 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c @@ -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; } diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c index ffbb0e32e92..8e8d5cf32e1 100644 --- a/drivers/bcma/sprom.c +++ b/drivers/bcma/sprom.c @@ -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) -- cgit v1.2.3-18-g5258