Commit 7f809e1f8e2f46c486bfe529579a16a28daacd62

Authored by Jason Gunthorpe
Committed by Grant Likely
1 parent 220bf991b0

of/flattree: Fix unhandled OF_DT_NOP tag when unflattening the device tree

NOPs within the property section are skipped, but NOPs between
OF_DT_END_NODE and OF_DT_BEGIN_NODE were not. My firmware NOPs out
entire nodes depending on various environment parameters.

of_scan_flat_dt already handles NOP more generally.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

Showing 1 changed file with 5 additions and 2 deletions Side-by-side Diff

... ... @@ -376,8 +376,11 @@
376 376 if (!np->type)
377 377 np->type = "<NULL>";
378 378 }
379   - while (tag == OF_DT_BEGIN_NODE) {
380   - mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
  379 + while (tag == OF_DT_BEGIN_NODE || tag == OF_DT_NOP) {
  380 + if (tag == OF_DT_NOP)
  381 + *p += 4;
  382 + else
  383 + mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
381 384 tag = be32_to_cpup((__be32 *)(*p));
382 385 }
383 386 if (tag != OF_DT_END_NODE) {