drm_bridge_clear_and_put(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 a struct drm_bridge, yes, double pointer, we love a pointer-to-a-pointer moment. bridge_pp must be non-NULL (non-negotiable, bestie). and if *bridge_pp is 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