提交 534e7a45 编写于 作者: H Hauke Mehrtens 提交者: John W. Linville

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: NHauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 edcc3604
...@@ -149,7 +149,9 @@ int bcma_bus_register(struct bcma_bus *bus) ...@@ -149,7 +149,9 @@ int bcma_bus_register(struct bcma_bus *bus)
/* Try to get SPROM */ /* Try to get SPROM */
err = bcma_sprom_get(bus); 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); pr_err("Failed to get SPROM: %d\n", err);
return -ENOENT; return -ENOENT;
} }
......
...@@ -143,6 +143,9 @@ int bcma_sprom_get(struct bcma_bus *bus) ...@@ -143,6 +143,9 @@ int bcma_sprom_get(struct bcma_bus *bus)
if (!bus->drv_cc.core) if (!bus->drv_cc.core)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!(bus->drv_cc.capabilities & BCMA_CC_CAP_SPROM))
return -ENOENT;
sprom = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16), sprom = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16),
GFP_KERNEL); GFP_KERNEL);
if (!sprom) if (!sprom)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册