diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2026-05-04 21:59:40 -0700 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2026-06-11 22:39:28 -0700 |
| commit | 58d42ec10b7324fa2965d74b9bfbacac3af55c70 (patch) | |
| tree | 9cc4e26db0d797985d3ac4b2150dd9e425e9d213 /scripts/basic | |
| parent | 4e5336f303e2845a82735b5578f7c0e4a175f8c5 (diff) | |
Input: rmi4 - refactor function allocation and registration
Currently, rmi_create_function() allocates memory for the rmi_function
structure, but rmi_register_function() initializes the device via
device_initialize(). This split of ownership makes error handling in
rmi_create_function() confusing because the caller must be aware that
if rmi_register_function() fails, it has already called put_device() to
clean up the memory.
To make the memory lifecycle explicit and fix potential leaks cleanly
introduce rmi_alloc_function() to handle memory allocation and device
initialization, and make the caller of rmi_register_function()
responsible for cleanup.
Assisted-by: Gemini:gemini-3.1-pro
Link: https://patch.msgid.link/20260505045952.1570713-10-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'scripts/basic')
0 files changed, 0 insertions, 0 deletions
