Skip to content

Commit

Permalink
bcma: add check if sprom is available before accessing it.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hauke Mehrtens authored and John W. Linville committed Jul 11, 2011
1 parent edcc360 commit 534e7a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/bcma/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions drivers/bcma/sprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 534e7a4

Please sign in to comment.