drm_bridge_clear_and_put(9)
π drm_bridge_clear_and_put β a Kernel API Manual moment (yes, section 9, we're in the kernel docs bestie) π
okay so real talk, this whole page lives in the Kernel API Manual, and it's about one tiny helper that does one tiny thing and does it correctly, which is honestly the vibe. β¨
πΈ NAME πΈ
drm_bridge_clear_and_put β you hand it a bridge pointer, it clears that pointer, then it puts the bridge. that's it. that's the whole thing. iconic behavior, no notes. π
β¨ SYNOPSIS β¨
void drm_bridge_clear_and_put (struct drm_bridge **bridge_pp );
π¦ ARGUMENTS π¦
bridge_ppβ a pointer to a pointer to astruct drm_bridge, yes, double pointer, we love a pointer-to-a-pointer moment.bridge_ppmust be non-NULL (non-negotiable, bestie). and if*bridge_ppis NULL, this function literally does nothing β it just sits there, unbothered, living its truth. π
π DESCRIPTION π
so this is a helper whose whole job is to put a DRM bridge β but only after it sets its pointer to NULL first. order matters, it's giving main character sequencing. β¨
the point? you can drop a struct drm_bridge reference without leaving behind a use-after-free window, where the bridge you're pointing at might have already been freed while you're still holding a pointer to it. and use-after-free is not the vibe. it's giving π and not in a cute way.
so for a struct drm_bridge *some_bridge, this code:
drm_bridge_clear_and_put(some_bridge);
is equivalent to the more complex:
struct drm_bridge *temp = some_bridge;
some_bridge = NULL;
drm_bridge_put(temp);
like, same result, but the first one ate and left no crumbs. π₯
π SEE ALSO π
the whole friend group, assembled, fr fr:
Kernel file ./drivers/gpu/drm/drm_bridge.c overview(9), display driver integration(9), special care dsi(9), dsi bridge operations(9), bridge chain format selection(9), drm_bridge_enter(9), drm_bridge_exit(9), drm_bridge_unplug(9), drm_bridge_get(9), drm_bridge_put(9), drm_bridge_put_void(9), drm_bridge_add(9), devm_drm_bridge_add(9), drm_bridge_remove(9), drm_bridge_attach(9), bridge operations(9), drm_bridge_chain_mode_valid(9), drm_bridge_chain_mode_set(9), drm_atomic_bridge_chain_disable(9), drm_atomic_bridge_chain_post_disable(9), drm_atomic_bridge_chain_pre_enable(9), drm_atomic_bridge_chain_enable(9), drm_atomic_bridge_chain_check(9), drm_bridge_detect(9), drm_bridge_get_modes(9), drm_bridge_edid_read(9), drm_bridge_hpd_enable(9), drm_bridge_hpd_disable(9), drm_bridge_hpd_notify(9), of_drm_find_and_get_bridge(9), of_drm_find_bridge(9), of_drm_get_bridge_by_endpoint(9), devm_drm_put_bridge(9)
ok that's the whole page and yes it's short, but it's correct and that's the energy we're bringing. go clear that pointer bestie π«Ά
kisses, this page came from ./drivers/gpu/drm, dated October 2026, and it's drm_bridge_clear_and_put(9) signing off πβπ
π¦ 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