devres_destroy(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… devres_destroy(9) β€” from the Kernel API Manual, bestie πŸŽ€

okay so this is devres_destroy(9), straight out of the Kernel API Manual, and it's about finding a device resource and just… yeeting it. no cap. let's get into it ✨


🌸 NAME 🌸

devres_destroy β€” bestie, it finds a device resource and destroys it. that's the whole vibe. πŸ’€


✨ SYNOPSIS ✨

int devres_destroy (struct device *dev , dr_release_t release ,
       dr_match_t match , void *match_data );

like, look at that signature. iconic. four args, one int back. periodt. πŸ‘‘


🫢 ARGUMENTS 🫢

  • dev β€” the device you're pulling the resource out of. this is your main character. 🌟
  • release β€” look for resources associated with this release function. that's the little tag you're matching on, iykyk. 🏷️
  • match β€” the match function, and heads up: it's optional. yes bestie, optional, we love a flexible queen. πŸ™ˆ
  • match_data β€” the data you're feeding into that match function. πŸ“

πŸ’– DESCRIPTION πŸ’–

so what this does is: it finds the latest devres of dev that's associated with release and for which match returns 1. and if match is NULL? it's considered to match all β€” no filter, we're accepting everyone at the door. 🌈

if it finds one, the resource is removed atomically and freed. boom. gone. slay. πŸ”₯

⚠️ but bestie, listen, this part is important: the release function for the resource will not be called. only the devres-allocated data gets freed. so the caller β€” that's you β€” becomes responsible for freeing any other data. no cap, don't forget. 😭

⭐ RETURN ⭐

  • 0 if the devres is found and freed. ate. πŸ’…
  • -ENOENT if it's not found. she wasn't there, we looked, moving on. πŸ¦‹

🧚 SEE ALSO 🧚

the whole friend group, honestly β€” first up, the kernel file ./drivers/base/devres.c, and then:


okay that's the whole page, ily, go free your memory responsibly πŸŽ€

sign-off szn: this one lives under ./drivers/base, dated October 2026, and it's devres_destroy(9) β€” catch you in the next one, bestie πŸ’œ

πŸ“¦ where this page comes from