ttm_bo_get_unless_zero(9)
π 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms