Re: [PATCH v2 5/5] regulator: qcom: Rework to single platform device

From: Bjorn Andersson
Date: Mon Apr 06 2015 - 12:59:43 EST


On Thu, Apr 2, 2015 at 4:02 PM, Stephen Boyd <sboyd@xxxxxxxxxxxxxx> wrote:
> On 04/01/15 15:55, Bjorn Andersson wrote:
>> +static int rpm_reg_probe(struct platform_device *pdev)
>> +{
>> + const struct rpm_regulator_data *reg;
>> + const struct of_device_id *match;
>> + struct regulator_config config = { };
>> + struct regulator_dev *rdev;
>> + struct qcom_rpm_reg *vreg;
>>
>> - ret = rpm_reg_of_parse(pdev->dev.of_node, &vreg->desc, &config);
>> - if (ret)
>> - return ret;
>> + match = of_match_device(rpm_of_match, &pdev->dev);
>> + for (reg = match->data; reg->name; reg++) {
>> + vreg = devm_kmalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL);
>> + if (!vreg) {
>> + dev_err(&pdev->dev, "failed to allocate vreg\n");
>
> Please remove useless error message on allocation failures.
>

I didn't want to touch this line, to keep the diff as clean as
possible. But I forgot about the promised patch to clean up this and
the rpm reference retrieval.

Sorry about that - will prepare the patch and send it out.

[..]

>>
>> - rdev = devm_regulator_register(&pdev->dev, &vreg->desc, &config);
>> - if (IS_ERR(rdev)) {
>> - dev_err(&pdev->dev, "can't register regulator\n");
>> - return PTR_ERR(rdev);
>> + config.dev = &pdev->dev;
>> + config.driver_data = vreg;
>> + rdev = devm_regulator_register(&pdev->dev, &vreg->desc, &config);
>> + if (IS_ERR(rdev)) {
>> + dev_err(&pdev->dev, "can't register regulator\n");
>
> It'd be nice to know which regulator failed to register.
>

I agree, will update this.

Regards,
Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/