[PATCH v2 2/4] misc: fastrpc: handle multi-cell reg in context bank probe
From: Vinayak Katoch
Date: Wed Oct 07 2026 - 07:44:37 EST
Platforms that use #address-cells = <2> on the fastrpc node encode the
context bank number in cell[1] of the reg property rather than cell[0].
Reading cell[0] on such platforms yields 0 for every context bank,
causing all sessions to share SID 0 and corrupting IOVA address
construction.
Use of_property_read_u32_index() with of_n_addr_cells() - 1 as the
index so the correct cell is read regardless of the parent address cell
width.
Signed-off-by: Vinayak Katoch <vinayak.katoch@xxxxxxxxxxxxxxxx>
---
drivers/misc/fastrpc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index b29c1fd00de2..5c7bb56cf46d 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -2348,7 +2348,8 @@ static int fastrpc_cb_init(struct platform_device *pdev)
if (!cctx)
return -EINVAL;
- if (of_property_read_u32(dev->of_node, "reg", &sid))
+ if (of_property_read_u32_index(dev->of_node, "reg",
+ of_n_addr_cells(dev->of_node) - 1, &sid))
dev_info(dev, "FastRPC Session ID not specified in DT\n");
spin_lock_irqsave(&cctx->lock, flags);
--
2.34.1