mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Alexander Aring <alex.aring@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2 1/2] tegra20: add pinctrl driver
Date: Sat, 11 May 2013 17:17:00 +0200	[thread overview]
Message-ID: <20130511151700.GQ32299@pengutronix.de> (raw)
In-Reply-To: <20130510190309.GA1500@x61s.Speedport_W_921V_1_21_000>

On Fri, May 10, 2013 at 09:03:10PM +0200, Alexander Aring wrote:
> Hi Lucas,
> 
> On Fri, May 10, 2013 at 08:28:57PM +0200, Lucas Stach wrote:
> > This adds a pinctrl driver for the Tegra 20 line of SoCs. It only
> > supports the three basic pinconfiguration settings function mux,
> > tristate control and pullup/down control.
> > 
> > The driver understands the same devicetree bindings as the Linux one,
> > unimplemented pinconfiguration options will be ignored.
> > 
> > Signed-off-by: Lucas Stach <dev@lynxeye.de>

[...]

> > +
> > +static int pinctrl_tegra20_probe(struct device_d *dev)
> > +{
> > +	struct pinctrl_tegra20 *ctrl;
> > +	int i, ret;
> > +	u32 **regs;
> > +
> > +	ctrl = xzalloc(sizeof(*ctrl));
> > +
> > +	/*
> > +	 * Tegra pincontrol is split out into four independent memory ranges:
> > +	 * tristate control, function mux, pullup/down control, pad control
> > +	 * (from lowest to highest hardware address).
> > +	 * We are only interested in the first three for now.
> > +	 */
> > +	regs = (u32 **)&ctrl->regs;
> > +	for (i = 0; i <= 2; i++) {
> > +		regs[i] = dev_request_mem_region(dev, i);
> > +		if (!regs[i]) {
> > +			dev_err(dev, "Could not get iomem region %d\n", i);
> Do we need a free(ctrl); here?

To be correct, yes, we would need a free() here.

I've never been very thoroughly with releasing the resources in the
error pathes in the drivers in barebox though and I never felt bad about
it.

The probe calls are called only once for each device and whether or not
we have a few bytes of malloc space more doesn't really matter. Also you
may have noticed that there even is no dev_release_mem_region in barebox
which makes nearly all error pathes wrong in barebox anyway.

And no, I don't want to have -EPROBE_DEFER in barebox.

So I don't really know what to do with the error pathes in driver probe
functions. I don't really care about them, but I also don't feel like
removing the freeing of resources either to reduce the binary size.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2013-05-11 15:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-10 18:28 Lucas Stach
2013-05-10 18:28 ` [PATCH v2 2/2] tegra: paz00: import pinconfig from Linux Lucas Stach
2013-05-10 19:03 ` [PATCH v2 1/2] tegra20: add pinctrl driver Alexander Aring
2013-05-11 15:17   ` Sascha Hauer [this message]
2013-05-12 13:48     ` Jean-Christophe PLAGNIOL-VILLARD
2013-10-22 15:07 ` Uwe Kleine-König

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=20130511151700.GQ32299@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=alex.aring@gmail.com \
    --cc=barebox@lists.infradead.org \
    /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