]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
devres: add free_node callback to struct devres_node
authorDanilo Krummrich <dakr@kernel.org>
Mon, 2 Feb 2026 23:48:18 +0000 (00:48 +0100)
committerDanilo Krummrich <dakr@kernel.org>
Tue, 17 Mar 2026 22:58:39 +0000 (23:58 +0100)
commit55e329d0f7a0a92cf998cc6f20df6e46a4d6ab12
tree05b7f8a8316f91f7f968f7ca4a4b792dbb1d3a86
parent2b5c6a14b5b4326916ef20b39eea3564ad786e9f
devres: add free_node callback to struct devres_node

Currently, there are three "subclasses" of struct devres_node, which are
struct devres, struct devres_group, struct devres_action.

release_nodes(), which only knows about the base struct devres_node,
assumes that for all "subclasses" struct devres_node is the first member
in the structure and calls kfree() on struct devres_node.

While this technically works, we can still improve semantical
correctness and type safety with a corresponding free_node() callback.

Additionally, we will need this callback soon in the Rust Devres code,
to allocate and free the required memory on the Rust side.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patch.msgid.link/20260202235210.55176-6-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
drivers/base/devres.c