Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: joe@perches.com (Joe Perches)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] timer: vt8500: Move system timer to clocksource
Date: Wed, 02 Jan 2013 23:45:14 -0800	[thread overview]
Message-ID: <1357199114.25181.48.camel@joe-AO722> (raw)
In-Reply-To: <20130103073540.GB11309@core.coreip.homeip.net>

On Wed, 2013-01-02 at 23:35 -0800, Dmitry Torokhov wrote:
> On Thu, Jan 03, 2013 at 04:25:09PM +1300, Tony Prisk wrote:
> > +static void __init vt8500_timer_init(void)
> > +{
> > +	struct device_node *np;
> > +	int timer_irq;
> > +
> > +	np = of_find_matching_node(NULL, vt8500_timer_ids);
> > +	if (!np) {
> > +		pr_err("%s: Timer description missing from Device Tree\n",
> > +								__func__);
> > +		return;
> > +	}
> > +	regbase = of_iomap(np, 0);
> > +	if (!regbase) {
> > +		pr_err("%s: Missing iobase description in Device Tree\n",
> > +								__func__);
> > +		of_node_put(np);
> > +		return;
> > +	}
> > +	timer_irq = irq_of_parse_and_map(np, 0);
> > +	if (!timer_irq) {
> > +		pr_err("%s: Missing irq description in Device Tree\n",
> > +								__func__);
> > +		of_node_put(np);
> > +		return;
> 
> You are forgetting to unmap the regbase here.

Also I think it'd be nicer to write something like:

	struct device_node *np;
	int timer_irq;
	const char *reason;

	np = of_find_matching_node(NULL, vt8500_timer_ids);
	if (!np) {
		reason = "timer";
	    goto error;
	}
	regbase = of_iomap(np, 0);
	if (!regbase) {
		reason = "iobase";
		goto error_put;
	}
	timer_irq = irq_of_parse_and_map(np, 0);
	if (!timer_irq) {
		reason = "irq";
		goto error_remap;
	}
 
	...

error_remap:
	unmap...;
error_put:
	of_node_put(np);
error:
	pr_err("%s: Missing %s description in Device Tree\n",
	       __func__, reason);
	return;

  reply	other threads:[~2013-01-03  7:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-03  3:25 [PATCH 0/2] Move some mach-vt8500 functions to new directories Tony Prisk
2013-01-03  3:25 ` [PATCH 1/2] timer: vt8500: Move system timer to clocksource Tony Prisk
2013-01-03  7:35   ` Dmitry Torokhov
2013-01-03  7:45     ` Joe Perches [this message]
2013-01-03  8:07       ` Arnd Bergmann
2013-01-03 17:29   ` Stephen Warren
2013-01-03  3:25 ` [PATCH 2/2] irqchip: vt8500: Move irq code to drivers/irqchip Tony Prisk
2013-01-03  4:38   ` Rob Herring
2013-01-03  4:53     ` Tony Prisk

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=1357199114.25181.48.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=linux-arm-kernel@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