On Thu, Jan 09, 2014 at 11:22:33AM +0000, Sachin Kamat wrote: > Add support for S2MPA01 voltage and current regulator. > > Signed-off-by: Sachin Kamat <sachin.kamat@xxxxxxxxxx> > --- > * Addressed comments from Mark Brown > - Used module_platform_driver instead of subsys init call > --- > drivers/regulator/Kconfig | 7 + > drivers/regulator/Makefile | 1 + > drivers/regulator/s2mpa01.c | 482 +++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 490 insertions(+) > create mode 100644 drivers/regulator/s2mpa01.c [...] > +static int s2mpa01_pmic_probe(struct platform_device *pdev) > +{ > + struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); > + struct sec_platform_data *pdata = dev_get_platdata(iodev->dev); > + struct of_regulator_match rdata[S2MPA01_REGULATOR_MAX]; > + struct device_node *reg_np = NULL; > + struct regulator_config config = { }; > + struct s2mpa01_info *s2mpa01; > + int i, ret; > + > + s2mpa01 = devm_kzalloc(&pdev->dev, sizeof(*s2mpa01), GFP_KERNEL); > + if (!s2mpa01) > + return -ENOMEM; > + > + for (i = 0; i < S2MPA01_REGULATOR_CNT; i++) > + rdata[i].name = regulators[i].name; > + > + if (iodev->dev->of_node) { > + reg_np = of_find_node_by_name(iodev->dev->of_node, > + "regulators"); This walks the allnodes list, and can thus walk outside of the parent node. Use of_get_child_by_name instead. > + if (!reg_np) { > + dev_err(&pdev->dev, > + "could not find regulators sub-node\n"); > + return -EINVAL; > + } > + > + of_regulator_match(&pdev->dev, reg_np, rdata, > + S2MPA01_REGULATOR_MAX); Is a reference to reg_np held beyond this? Do you need an of_node_put(reg_np)? Thanks, Mark. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html