ttm_bo_get_unless_zero(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– ttm_bo_get_unless_zero(9) πŸ’–

ok so bestie, welcome to the <pink>Kernel API Manual</pink> ✨ β€” this is ttm_bo_get_unless_zero, and it's lowkey one of those tiny functions that saves your whole entire life. let's get into it 🫢


🌸 NAME 🌸

ttm_bo_get_unless_zero β€” grab a reference to a struct ttm_buffer_object, but only if its refcount hasn't already hit zero. no cap, that "unless zero" part is the whole personality πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

struct ttm_buffer_object * ttm_bo_get_unless_zero (struct
ttm_buffer_object *bo );

πŸŽ€ ARGUMENTS πŸŽ€

  • bo β€” the buffer object. that's it. that's the whole argument list. she's simple, she's iconic πŸ‘‘

πŸ”₯ DESCRIPTION πŸ”₯

so here's the vibe check ✨ β€” you use this when you're doing lookups and you need to take a reference to a TTM buffer object, but with a little safety net. specifically:

  • it's for lookups where the object gets removed from the lookup structure during the destructor, and
  • it's for RCU lookups πŸ‘€

basically, if the refcount has already reached zero, don't touch it β€” that's the whole point. this function's got your back, fr fr πŸ˜­πŸ’œ


⭐ RETURN ⭐

  • bo β€” if the referencing was successful πŸ’–
  • NULL β€” otherwise πŸ™ˆ

yes bestie, it can literally just hand you NULL. check for it. i'm serious. 🫢


🌈 SEE ALSO 🌈

  • ttm_bo_get(9)
  • Kernel file ./drivers/gpu/drm/ttm/ttm_bo_internal.h

ok that's the whole page, no notes πŸ’…

./drivers/gpu/drm/ttm 🌸 October 2026 🌸 ttm_bo_get_unless_zero(9)

mwah, that's a wrap β€” go reference responsibly, bestie πŸ§šπŸ’–βœ¨

πŸ“¦ where this page comes from