summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 74e00d7791..6ea21a4609 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -163,11 +163,17 @@ int of_regulator_register(struct regulator_dev *rd, struct device_node *node)
struct regulator_internal *ri;
const char *name;
+ if (!rd || !node)
+ return -EINVAL;
+
rd->boot_on = of_property_read_bool(node, "regulator-boot-on");
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",