lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140212180223.GA23630@e106331-lin.cambridge.arm.com>
Date:	Wed, 12 Feb 2014 18:02:23 +0000
From:	Mark Rutland <mark.rutland@....com>
To:	Sachin Kamat <sachin.kamat@...aro.org>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	"sbkim73@...sung.com" <sbkim73@...sung.com>,
	"lee.jones@...aro.org" <lee.jones@...aro.org>,
	"lgirdwood@...il.com" <lgirdwood@...il.com>,
	"broonie@...nel.org" <broonie@...nel.org>,
	"patches@...aro.org" <patches@...aro.org>
Subject: Re: [PATCH v2 2/3] regulator: Add support for S2MPA01 regulator

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@...aro.org>
> ---
> * 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 linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ