commit
7a172ae7a3fc "fdt: fix incorrect placement of partition information for atmel_nand"
breaks the placement of the mtd partitions for other nand drivers.
Correct the condition to break out of the loop searching for subnodes
to fix this.
for (ndepth = 0, off = fdt_next_node(blob, parent_offset, &ndepth);
(off >= 0) && (ndepth > 0);
off = fdt_next_node(blob, off, &ndepth)) {
for (ndepth = 0, off = fdt_next_node(blob, parent_offset, &ndepth);
(off >= 0) && (ndepth > 0);
off = fdt_next_node(blob, off, &ndepth)) {
+ if (ndepth < 0)
+ break;
+ else if (ndepth != 1)
- if (fdt_getprop(blob, off, "compatible", NULL))
+ else if (fdt_getprop(blob, off, "compatible", NULL))
continue;
debug("delete %s: offset: %x\n",
fdt_get_name(blob, off, 0), off);
continue;
debug("delete %s: offset: %x\n",
fdt_get_name(blob, off, 0), off);
int ret;
while ((off = fdt_next_node(blob, off, &ndepth)) > 0) {
int ret;
while ((off = fdt_next_node(blob, off, &ndepth)) > 0) {
+ if (ndepth < 0)
+ break;
+ else if (ndepth != 1)
- if (fdt_getprop(blob, off, "compatible", NULL))
+ else if (fdt_getprop(blob, off, "compatible", NULL))
continue;
prop = fdt_getprop(blob, off, "label", NULL);
if (prop == NULL) {
continue;
prop = fdt_getprop(blob, off, "label", NULL);
if (prop == NULL) {
* the offset in this case
*/
while ((off = fdt_next_node(blob, off, &ndepth)) > 0) {
* the offset in this case
*/
while ((off = fdt_next_node(blob, off, &ndepth)) > 0) {
+ if (ndepth < 0)
+ break;
+ else if (ndepth != 1)
- if (fdt_getprop(blob, off, "compatible", NULL))
+ else if (fdt_getprop(blob, off, "compatible", NULL))
continue;
parent_offset = off;
break;
continue;
parent_offset = off;
break;