[PATCH 06/18] regulator: improve of_regulator_register error handling

Marco Felsch m.felsch at pengutronix.de
Mon Sep 28 11:50:29 EDT 2020


Don't ignore errors from __regulator_register().

Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
 drivers/regulator/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 74e00d7791..a767e383fb 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -168,6 +168,9 @@ int of_regulator_register(struct regulator_dev *rd, struct device_node *node)
 	name = of_get_property(node, "regulator-name", NULL);
 
 	ri = __regulator_register(rd, name);
+	if (IS_ERR(ri))
+		return PTR_ERR(ri);
+
 	ri->node = node;
 
 	of_property_read_u32(node, "regulator-enable-ramp-delay",
-- 
2.20.1




More information about the barebox mailing list