From: Joseph J. <jo...@ge...> - 2007-06-25 14:30:34
|
Andreas Schwab wrote: > Joseph Jezak <jo...@ge...> writes: > >> I've already fixed this in SVN. Please try that and let me know if >> it works for you. > > The changes in find_physical_rom are not complete, AFAIK. I don't think > you can use dn->next for finding the next node, instead you have to > repeat of_find_by_name or of_find_by_name, resp. Also, there are calls > to of_node_put missing. > > Andreas. > > --- dev.c > +++ dev.c > @@ -72,18 +72,27 @@ find_physical_rom( int *base, int *size > #ifndef CONFIG_AMIGAONE > struct device_node *dn; > int len, *p; > + int by_type = 0; > > - if( !(dn=find_devices("boot-rom")) && !(dn=find_type_devices("rom")) ) > + dn = of_find_node_by_name(NULL, "boot-rom"); > + if (!dn) { > + by_type = 1; > + dn = of_find_node_by_type(NULL, "rom"); > + } > + if (!dn) > return 0; > do { > - if( !(p=(int*)get_property(dn, "reg", &len)) || len != sizeof(int[2]) ) > + if( !(p=(int*)get_property(dn, "reg", &len)) || len != sizeof(int[2]) ) { > + of_node_put(dn); > return 0; > + } > if( (unsigned int)(0xfff00100 - p[0]) < (unsigned int)p[1] ) { > *base = p[0]; > *size = p[1]; > + of_node_put(dn); > return 1; > } > - dn = dn->next; > + dn = by_type ? of_find_node_by_type(dn, "rom") : of_find_node_by_name(dn, "boot-rom"); > } while( dn ); > #endif > > Sorry about not getting back to you sooner, I've added your suggestion to SVN, thanks! -Joe |