Skip to content

Commit f49c7fa

Browse files
Colin Ian Kingrobherring
authored andcommitted
of/address: check for invalid range.cpu_addr
Currently invalid CPU addresses are not being sanity checked resulting in SATA setup failure on a SynQuacer SC2A11 development machine. The original check was removed by and earlier commit, so add a sanity check back in to avoid this regression. Fixes: 7a8b64d ("of/address: use range parser for of_dma_get_range") Signed-off-by: Colin Ian King <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring <[email protected]>
1 parent 9123e3a commit f49c7fa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/of/address.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,11 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz
985985
/* Don't error out as we'd break some existing DTs */
986986
continue;
987987
}
988+
if (range.cpu_addr == OF_BAD_ADDR) {
989+
pr_err("translation of DMA address(%llx) to CPU address failed node(%pOF)\n",
990+
range.bus_addr, node);
991+
continue;
992+
}
988993
dma_offset = range.cpu_addr - range.bus_addr;
989994

990995
/* Take lower and upper limits */

0 commit comments

Comments
 (0)