[PATCH] Use of_get_next_child() in k2_sata_proc_info()
Michael Ellerman
michael at ellerman.id.au
Wed Oct 24 14:25:16 EST 2007
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 at ellerman.id.au>
---
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;
--
1.5.1.3.g7a33b
More information about the Linuxppc-dev
mailing list