of_property_read_string(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– of_property_read_string(9) β€” kernel API manual, but make it make sense πŸŽ€

okay bestie, this is the page for of_property_read_string(9) and honestly it's a whole vibe: it's the little function that goes digging in a device tree node and pulls out a string for you. let's get into it ✨


🌸 NAME 🌸

of_property_read_string β€” literally just "Find and read a string from a property". that's it, that's the whole job πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

int of_property_read_string (const struct device_node *np , const char
*propname , const char **out_string );

three args, one int back, no drama 😌


πŸŽ€ ARGUMENTS πŸŽ€

  • np β€” the device node you're reading the property value from. your starting point, your main character node πŸ‘‘
  • propname β€” the name of the property you're searching for. the thing you're hunting πŸ”
  • out_string β€” a pointer to a null terminated return string. important bit: it only gets modified if the return value is 0. so if things go sideways, your pointer stays untouched, no cap πŸ™ˆ

⭐ DESCRIPTION ⭐

so what it does is: search for a property inside a device tree node, and retrieve a null terminated string value. and here's the tea β€” it gives you a pointer to the data, not a copy. no duplicating, no malloc-ing, just vibes and a reference 🫢

⚠️ careful bestie, there's a trap: the empty string "" has length of 1, which means -ENODATA cannot be interpreted as an empty string. so don't be out here thinking "no data" means "empty string" β€” it does not, fr fr πŸ’€

and the out_string pointer is modified only if a valid string can be decoded. so like... it's picky, in a good way πŸ’…


πŸ”₯ RETURN πŸ”₯

  • 0 β€” success, we ate, we slayed ✨
  • -EINVAL β€” the property does not exist 😭
  • -ENODATA β€” the property exists but does not have a value πŸ™ˆ
  • -EILSEQ β€” the string is not null-terminated within the length of the property data. messy. not iconic πŸ’€

🌈 SEE ALSO 🌈

kernel file ./drivers/of/property.c, plus this whole friend group of related functions (yes, all of them, i'm not skipping a single one β€” we don't do that here 🫢):


and that's the page!! πŸ’œ it's from ./drivers/of, dated October 2026, and it lives in the of_property_read_string(9) era of your life now. go read some strings, bestie, you've got this πŸ§šβœ¨πŸ“

πŸ“¦ where this page comes from