diff options
Diffstat (limited to 'drivers/regulator/max8907-regulator.c')
-rw-r--r-- | drivers/regulator/max8907-regulator.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c index d1a77512d83e..4568c15fa78d 100644 --- a/drivers/regulator/max8907-regulator.c +++ b/drivers/regulator/max8907-regulator.c @@ -224,11 +224,11 @@ static struct of_regulator_match max8907_matches[] = { static int max8907_regulator_parse_dt(struct platform_device *pdev) { - struct device_node *np = pdev->dev.parent->of_node; - struct device_node *regulators; + struct device_node *np, *regulators; int ret; - if (!pdev->dev.parent->of_node) + np = of_node_get(pdev->dev.parent->of_node); + if (!np) return 0; regulators = of_find_node_by_name(np, "regulators"); @@ -237,9 +237,9 @@ static int max8907_regulator_parse_dt(struct platform_device *pdev) return -EINVAL; } - ret = of_regulator_match(pdev->dev.parent, regulators, - max8907_matches, + ret = of_regulator_match(&pdev->dev, regulators, max8907_matches, ARRAY_SIZE(max8907_matches)); + of_node_put(regulators); if (ret < 0) { dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", ret); |