summaryrefslogtreecommitdiff
path: root/include/uapi/linux/raid
diff options
context:
space:
mode:
authorZilin Guan <zilin@seu.edu.cn>2025-12-31 11:49:15 +0000
committerRob Herring (Arm) <robh@kernel.org>2026-01-02 15:36:37 -0600
commit235a1eb8d2dcc49a6cf0a5ee1aa85544a5d0054b (patch)
tree8e99744f5c7b7ed1d4ac40242ed87d23f5191a7f /include/uapi/linux/raid
parent4f4f6b4467e63317ec3fd0a5b7405757ad55c169 (diff)
of: unittest: Fix memory leak in unittest_data_add()
In unittest_data_add(), if of_resolve_phandles() fails, the allocated unittest_data is not freed, leading to a memory leak. Fix this by using scope-based cleanup helper __free(kfree) for automatic resource cleanup. This ensures unittest_data is automatically freed when it goes out of scope in error paths. For the success path, use retain_and_null_ptr() to transfer ownership of the memory to the device tree and prevent double freeing. Fixes: 2eb46da2a760 ("of/selftest: Use the resolver to fixup phandles") Suggested-by: Rob Herring <robh@kernel.org> Co-developed-by: Jianhao Xu <jianhao.xu@seu.edu.cn> Signed-off-by: Jianhao Xu <jianhao.xu@seu.edu.cn> Signed-off-by: Zilin Guan <zilin@seu.edu.cn> Link: https://patch.msgid.link/20251231114915.234638-1-zilin@seu.edu.cn Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Diffstat (limited to 'include/uapi/linux/raid')
0 files changed, 0 insertions, 0 deletions