fdt_node_offset_by_phandle(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– fdt_node_offset_by_phandle(9) β€” Kernel API Manual πŸ’–

okay so bestie, welcome to the manual page for fdt_node_offset_by_phandle, straight out of the Kernel API Manual. Yes it's a mouthful, no you don't have to say it out loud, just know it's giving "find my node" energy and we're gonna walk through it together 🫢


✨ NAME ✨

fdt_node_offset_by_phandle β€” find the node with a given phandle

Like, that's literally it. It finds a node. By its phandle. Iconic behaviour honestly πŸ‘‘


🌸 SYNOPSIS 🌸

int fdt_node_offset_by_phandle (const void *fdt , uint32_t phandle );

Two args, one int back. Simple. Elegant. Not messy. We love a compact signature πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • fdt β€” pointer to the device tree blob πŸ¦‹ this is your tree, your whole vibe, the thing you're searching through
  • phandle β€” phandle value πŸ”₯ the number you're hunting for, no cap

πŸ’œ DESCRIPTION πŸ’œ

So fdt_node_offset_by_phandle returns the offset of the node which has the given phandle value. That's the whole job bestie, it's a lookup, and it ate πŸ’…

but listen β€” if there is more than one node in the tree with the given phandle (an invalid tree 😭), results are undefined. Not "it picks the first one", not "it's fine". Undefined. So don't come crying to me if your tree is cursed πŸ™ˆ

⭐ RETURN ⭐

Here's what you get back, and you gotta read it carefully because there are several moods this function can be in:

  • structure block offset of the located node (>= 0), on success ✨ slay, you found it
  • -FDT_ERR_NOTFOUND β€” no node with that phandle exists πŸ’€ it's just not there babe
  • -FDT_ERR_BADPHANDLE β€” given phandle value was invalid (0 or -1) 🚩 yeah those two are not it
  • -FDT_ERR_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, -FDT_ERR_BADSTRUCTURE β€” standard meanings 🌈

πŸ¦‹ SEE ALSO πŸ¦‹

grab a snack, this list is long and every single one of them is invited to the party πŸŽ‰

Kernel file ./scripts/dtc/libfdt/libfdt.h πŸ’–


and that's the whole page bestie, go find your phandle πŸ’…βœ¨

sign-off time πŸŽ€: this one lives in ./scripts/dtc/libfdt and it's dated October 2026, so like, future energy fr fr. mwah πŸ’‹

πŸ“¦ where this page comes from