drm_dp_mst_get_port_malloc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ drm_dp_mst_get_port_malloc(9) ✨

okay so bestie, we're in the Kernel API Manual today and this one's a lil reference-counting baddie from the DRM DP MST world πŸ’… she's short, she's sweet, she's load-bearing.


🌸 NAME 🌸

drm_dp_mst_get_port_malloc β€” increment the malloc refcount of an MST port πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

void drm_dp_mst_get_port_malloc (struct drm_dp_mst_port *port );

πŸ’– ARGUMENTS πŸ’–

  • port β€” the struct drm_dp_mst_port you're bumping the malloc refcount on. that's it, that's the whole argument, she's low maintenance 🫢

πŸ‘‘ DESCRIPTION πŸ‘‘

So what she actually does: she increments drm_dp_mst_port.malloc_kref. that's the vibe. ⭐

And like β€” when drm_dp_mst_port.malloc_kref hits 0, the memory allocation for port gets released and port may no longer be used. gone. done. don't touch. πŸ’€

🚨 okay this is the important bit, no cap: port could potentially be freed at any time by the DP MST helpers if drm_dp_mst_port.malloc_kref reaches 0 β€” including during a call to this function. so like... yeah. be careful. 😭

because of that, drivers that wanna make use of struct drm_dp_mst_port should ensure that they grab at least one main malloc reference to their MST ports in drm_dp_mst_topology_cbs.add_connector. why that callback specifically? because it's called before there's any chance for drm_dp_mst_port.malloc_kref to reach 0. iconic safety window, honestly. ✨

See also: drm_dp_mst_put_port_malloc 🧚


🌈 SEE ALSO 🌈

Kernel file ./drivers/gpu/drm/display/drm_dp_mst_topology.c


that's the whole page bestie, short and slay πŸ“

source path: ./drivers/gpu/drm/display 🌸 dated: October 2026 πŸ¦‹ mwah, go grab your malloc refs responsibly πŸ’œ

πŸ“¦ where this page comes from