usb_free_noncoherent(9)
π
usb_free_noncoherent β the usb_free_noncoherent(9) moment
okay so bestie, we're in the Kernel API Manual today and this one is genuinely a whole vibe β it's the cleanup function. the closer. the "ok we're done here, release the buffer" main character π
πΈ NAME πΈ
usb_free_noncoherent β literally the function that frees memory allocated with usb_alloc_noncoherent(). that's it. that's the job. she's the undo button π
β¨ SYNOPSIS β¨
void usb_free_noncoherent (struct usb_device *dev , size_t size , void
*addr , enum dma_data_direction dir , struct sg_table *table );
like, exactly that signature, no cap. void return, five args, copy it character for character or the compiler will simply not vibe with you π
π¦ ARGUMENTS π¦
devβ the device the buffer was used with. the whole point, the moment, the context πsizeβ the requested buffer size. yes you have to remember it. yes it has to be the same one πaddrβ CPU address of buffer. the actual pointer bestie πdirβ the DMA transfer direction. iconic enum, must match π§tableβ describes the allocated and DMA mapped memory, π (yes the original had that trailing comma, I'm keeping her, she's part of the lore)
π DESCRIPTION π
so what this actually does: it reclaims an I/O buffer, letting it be reused. giving it a second life. a little recycling era for your kernel memory β»οΈβ¨
β οΈ but listen β the memory must have been allocated using usb_alloc_noncoherent, and the parameters must match those provided in that allocation request. no improvising. no "close enough". fr fr the values have to line up or you're in undefined-behaviour territory and that is not the slay you think it is π
π₯ SEE ALSO π₯
kernel file ./drivers/usb/core/usb.c β and honestly the whole friend group showed up to this party:
usb_find_common_endpoints(9)usb_find_common_endpoints_reverse(9)usb_find_endpoint(9)usb_check_bulk_endpoints(9)usb_check_int_endpoints(9)usb_find_alt_setting(9)usb_ifnum_to_if(9)usb_altnum_to_altsetting(9)usb_find_interface(9)usb_for_each_dev(9)usb_release_dev(9)usb_alloc_dev(9)usb_get_dev(9)usb_put_dev(9)usb_get_intf(9)usb_put_intf(9)usb_intf_get_dma_device(9)usb_lock_device_for_reset(9)usb_get_current_frame_number(9)usb_alloc_coherent(9)usb_free_coherent(9)usb_alloc_noncoherent(9)usb_endpoint_max_periodic_payload(9)usb_endpoint_is_hs_isoc_double(9)
and that's the page!! no notes. sourced straight from ./drivers/usb/core, dated October 2026, page usb_free_noncoherent(9) β go free that buffer and hydrate 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