linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Todd Poynor <toddpoynor@google.com>
To: Tero Kristo <t-kristo@ti.com>
Cc: linux-omap@vger.kernel.org, broonie@opensource.wolfsonmicro.com,
	lrg@ti.com, khilman@ti.com
Subject: Re: [PATCHv2 2/5] regulator: omap smps regulator driver
Date: Wed, 13 Jul 2011 23:29:04 -0700	[thread overview]
Message-ID: <20110714062904.GC22467@google.com> (raw)
In-Reply-To: <1310565638-13140-3-git-send-email-t-kristo@ti.com>

On Wed, Jul 13, 2011 at 05:00:35PM +0300, Tero Kristo wrote:
> OMAP SMPS regulator driver provides access to OMAP voltage processor
> controlled regulators. These include VDD1 and VDD2 for OMAP3 and additionally
> VDD3 for OMAP4. SMPS regulators use the OMAP voltage layer for the actual
> voltage regulation operations.
> 
> Signed-off-by: Tero Kristo <t-kristo@ti.com>
> ---
...
> +	for (i = 0; i < pdata->num_regulators; i++) {
> +		initdata = pdata->regulators[i];
> +
> +		c = &initdata->constraints;
> +		c->valid_modes_mask &= REGULATOR_MODE_NORMAL;
> +		c->valid_ops_mask &= REGULATOR_CHANGE_VOLTAGE;
> +		c->always_on = true;
> +
> +		voltdm = omap_voltage_domain_lookup(
> +			initdata->consumer_supplies[0].dev_name);
> +
> +		if (IS_ERR(voltdm)) {
> +			dev_err(&pdev->dev, "can't find voltdm %s, %ld\n",
> +				initdata->consumer_supplies[0].dev_name,
> +				PTR_ERR(voltdm));
> +			return PTR_ERR(voltdm);


Or maybe continue to next loop iteration.

> +		}
> +		info = kzalloc(sizeof(struct omap_smps_reg_info), GFP_KERNEL);
> +
> +		info->voltdm = voltdm;


Check kzalloc NULL return.

> +		info->desc.ops = &omap_smps_ops;
> +		info->desc.name = c->name;
> +		info->desc.type = REGULATOR_VOLTAGE;
> +		info->desc.n_voltages = 0;
> +		rdev = regulator_register(&info->desc, &pdev->dev, initdata,
> +			info);
> +		if (IS_ERR(rdev)) {
> +			dev_err(&pdev->dev, "can't register %s, %ld\n",
> +				info->desc.name, PTR_ERR(rdev));
> +			return PTR_ERR(rdev);

Or suggest continue to next loop iteration.

> +		}
> +		platform_set_drvdata(pdev, rdev);

Performed in a loop, but only last iteration's rdev is set as the
driver data for pdev.  Platform driver data should be pdata?

> +	}
> +
> +	return 0;
> +}
> +
> +static int omap_smps_reg_remove(struct platform_device *pdev)
> +{
> +	regulator_unregister(platform_get_drvdata(pdev));


Should kfree() the struct omap_smps_reg_info data structure(s) and
platform_set_drvdata(pdev, NULL) ?


Todd

  parent reply	other threads:[~2011-07-14  6:29 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-13 14:00 [PATCHv2 0/5] OMAP SMPS regulator driver Tero Kristo
2011-07-13 14:00 ` [PATCHv2 1/5] OMAP: move voltage.h and vp.h under platform include directory Tero Kristo
2011-07-13 14:00 ` [PATCHv2 2/5] regulator: omap smps regulator driver Tero Kristo
2011-07-13 14:40   ` Mark Brown
2011-07-13 15:53     ` Tero Kristo
2011-07-13 22:55       ` Mark Brown
2011-07-14  7:51         ` Tero Kristo
2011-07-14  6:29   ` Todd Poynor [this message]
2011-07-14  7:23     ` Tero Kristo
2011-07-13 14:00 ` [PATCHv2 3/5] omap3: beagle: instantiate smps regulators Tero Kristo
2011-07-13 14:00 ` [PATCHv2 4/5] TEMP: OMAP3: beagle rev-c4: enable OPP6 Tero Kristo
2011-07-13 17:49   ` Premi, Sanjeev
2011-07-14  7:10     ` Tero Kristo
2011-07-14  8:46       ` Premi, Sanjeev
2011-07-13 14:00 ` [PATCHv2 5/5] omap: voltage: changed parameter of omap_voltage_lookup to const Tero Kristo
2011-07-13 19:00 ` [PATCHv2 0/5] OMAP SMPS regulator driver Kevin Hilman
2011-07-13 23:22   ` Mark Brown
2011-07-13 23:51     ` Kevin Hilman
2011-07-14  0:22 ` Kevin Hilman
2011-07-14  7:24   ` Tero Kristo
2011-07-18  8:19 ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110714062904.GC22467@google.com \
    --to=toddpoynor@google.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=khilman@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=t-kristo@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).