]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
HID: Document memory allocation properties of report_fixup()
authorGünther Noack <gnoack@google.com>
Thu, 19 Feb 2026 15:43:35 +0000 (16:43 +0100)
committerBenjamin Tissoires <bentiss@kernel.org>
Thu, 19 Feb 2026 17:57:38 +0000 (18:57 +0100)
commit6b3e458806e34f1142592f786d3eb0ebac209cc2
tree79fa16dfd8d9de7200f85d81326eb434f982437e
parentf50822fd8675c68d294e89bd102f7b487ca3acd3
HID: Document memory allocation properties of report_fixup()

The memory pointer returned by the report_fixup() hook does not get
freed by the caller.  Instead, report_fixup() must return (in return
value and *rsize) a memory buffer with at least the same lifetime as
the input buffer (defined by rdesc and original *rsize).

This is usually achieved using one of the following techniques:

* Returning a pointer and size to a sub-portion of the input buffer
* Returning a pointer to a static buffer
* Allocating a buffer with a devm_*() function,
  which will automatically get freed when the device is removed.

Signed-off-by: Günther Noack <gnoack@google.com>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
include/linux/hid.h