Skip to content

Commit ecf47e9

Browse files
haukelinvjw
authored andcommitted
bcma: only map wrapper if its address is available
The Chipcommon B core does not have a wrap address and it would fail here. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 89be7ce commit ecf47e9

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

‎drivers/bcma/host_soc.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,16 @@ static void bcma_host_soc_block_write(struct bcma_device *core,
134134

135135
static u32 bcma_host_soc_aread32(struct bcma_device *core, u16 offset)
136136
{
137+
if (WARN_ONCE(!core->io_wrap, "Accessed core has no wrapper/agent\n"))
138+
return ~0;
137139
return readl(core->io_wrap + offset);
138140
}
139141

140142
static void bcma_host_soc_awrite32(struct bcma_device *core, u16 offset,
141143
u32 value)
142144
{
145+
if (WARN_ONCE(!core->io_wrap, "Accessed core has no wrapper/agent\n"))
146+
return;
143147
writel(value, core->io_wrap + offset);
144148
}
145149

‎drivers/bcma/scan.c‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,13 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
421421
core->io_addr = ioremap_nocache(core->addr, BCMA_CORE_SIZE);
422422
if (!core->io_addr)
423423
return -ENOMEM;
424-
core->io_wrap = ioremap_nocache(core->wrap, BCMA_CORE_SIZE);
425-
if (!core->io_wrap) {
426-
iounmap(core->io_addr);
427-
return -ENOMEM;
424+
if (core->wrap) {
425+
core->io_wrap = ioremap_nocache(core->wrap,
426+
BCMA_CORE_SIZE);
427+
if (!core->io_wrap) {
428+
iounmap(core->io_addr);
429+
return -ENOMEM;
430+
}
428431
}
429432
}
430433
return 0;

0 commit comments

Comments
 (0)