[RFC 1/5] i3c: show error with node for invalid reg property

From: Ben Dooks
Date: Wed Jun 21 2023 - 12:20:19 EST


When adding i3c devices via fdt, it is useful to get an error if the
reg node is wrong (say, you thought it was an i2c device and only
needed one value here) and have the error show the OF node which was
the cause of the problem (in case of many devices in the system),

Signed-off-by: Ben Dooks <ben.dooks@xxxxxxxxxxxxxxx>
---
drivers/i3c/master.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 08aeb69a7800..559fc2781a81 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -2094,8 +2094,10 @@ static int of_i3c_master_add_dev(struct i3c_master_controller *master,
return -EINVAL;

ret = of_property_read_u32_array(node, "reg", reg, ARRAY_SIZE(reg));
- if (ret)
+ if (ret) {
+ dev_err(&master->dev, "%pOF: invalid reg property", node);
return ret;
+ }

/*
* The manufacturer ID can't be 0. If reg[1] == 0 that means we're
--
2.40.1