linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Michael Ellerman <michael@ellerman.id.au>
Cc: linuxppc-dev@ozlabs.org, jgarzik@pobox.com
Subject: Re: [PATCH] Use of_get_next_child() in k2_sata_proc_info()
Date: Wed, 24 Oct 2007 15:01:57 +1000	[thread overview]
Message-ID: <1193202117.2085.45.camel@pasglop> (raw)
In-Reply-To: <2576ec47fb43bd1f4464beb8b78adfa70bdde418.1193199877.git.michael@ellerman.id.au>


On Wed, 2007-10-24 at 14:25 +1000, Michael Ellerman wrote:
> k2_sata_proc_info() uses its own hand-rolled loop to check a nodes
> children for a property, this is not safe WRT refcounting, so fix it
> to use of_get_next_child().
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

(Pending you test boot it on one of our G5s first !)

> ---
>  drivers/ata/sata_svw.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
> index 12d613c..64c3812 100644
> --- a/drivers/ata/sata_svw.c
> +++ b/drivers/ata/sata_svw.c
> @@ -289,7 +289,10 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
>  
>  	/* Match it to a port node */
>  	index = (ap == ap->host->ports[0]) ? 0 : 1;
> -	for (np = np->child; np != NULL; np = np->sibling) {
> +
> +	for (np = of_get_next_child(np, NULL);
> +	     np != NULL;
> +	     np = of_get_next_child(np, np)) {
>  		const u32 *reg = of_get_property(np, "reg", NULL);
>  		if (!reg)
>  			continue;

  reply	other threads:[~2007-10-24  5:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-24  4:25 [PATCH] Use of_get_next_child() in k2_sata_proc_info() Michael Ellerman
2007-10-24  5:01 ` Benjamin Herrenschmidt [this message]
2007-10-24  5:31   ` Michael Ellerman
2007-10-24  6:04   ` Jeff Garzik
2007-10-24  6:23     ` Michael Ellerman

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=1193202117.2085.45.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=jgarzik@pobox.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=michael@ellerman.id.au \
    /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).