# \[PATCH\] Use of\_get\_next\_child() in riva\_get\_EDID\_OF()

- From: Michael Ellerman \<hidden\>
- Date: 2007-10-24 04:26:22 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2007/10/9429316
- Thread: https://ratatoskr.run/linuxppc-dev/2007/10/9429316/t.md

```text
riva_get_EDID_OF() 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 <redacted>
---
 drivers/video/riva/fbdev.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 5c47968..07b6b2d 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -1759,7 +1759,10 @@ static int __devinit riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd)
 
 	NVTRACE_ENTER();
 	dp = pci_device_to_OF_node(pd);
-	for (; dp != NULL; dp = dp->child) {
+
+	for (dp = of_get_next_child(dp, NULL);
+	     dp != NULL;
+	     dp = of_get_next_child(dp, dp)) {
 		disptype = of_get_property(dp, "display-type", NULL);
 		if (disptype == NULL)
 			continue;
-- 
1.5.1.3.g7a33b
```
