[PATCH master] i2c: don't return error pointers from of_find_i2c_adapter_by_node
Ahmad Fatoum
a.fatoum at pengutronix.de
Fri Feb 16 14:03:37 PST 2024
All callers of of_find_i2c_adapter_by_node expect errors to be indicated
by NULL and don't check non-NULL pointers with IS_ERR().
Therefore map of_device_ensure_probed() errors to NULL as well to avoid
dereferencing error pointers.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/i2c/i2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c
index 70d1b810c1c3..1985ddfdc776 100644
--- a/drivers/i2c/i2c.c
+++ b/drivers/i2c/i2c.c
@@ -593,7 +593,7 @@ struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)
ret = of_device_ensure_probed(node);
if (ret)
- return ERR_PTR(ret);
+ return NULL;
for_each_i2c_adapter(adap)
if (adap->dev.of_node == node)
--
2.39.2
More information about the barebox
mailing list