[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK9yfHzm5Z8Ajn2GQsjLeLxKeP+AuGXCBxsTX=1h7fOASqwekg@mail.gmail.com>
Date: Thu, 13 Feb 2014 10:54:28 +0530
From: Sachin Kamat <sachin.kamat@...aro.org>
To: Mark Rutland <mark.rutland@....com>
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>
Subject: Re: [PATCH v2 2/3] regulator: Add support for S2MPA01 regulator
On 12 February 2014 23:32, Mark Rutland <mark.rutland@....com> wrote:
> 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.
OK.
>
>> + 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)?
Yes, you are right.
Thanks for the review.
--
With warm regards,
Sachin
--
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