aboutsummaryrefslogtreecommitdiff
path: root/include/linux/cleanup.h
AgeCommit message (Collapse)AuthorFilesLines
2023-09-13cleanup: Make no_free_ptr() __must_checkPeter Zijlstra1-3/+36
recent discussion brought about the realization that it makes sense for no_free_ptr() to have __must_check semantics in order to avoid leaking the resource. Additionally, add a few comments to clarify why/how things work. All credit to Linus on how to combine __must_check and the stmt-expression. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
2023-06-26locking: Introduce __cleanup() based infrastructurePeter Zijlstra1-0/+171
Use __attribute__((__cleanup__(func))) to build: - simple auto-release pointers using __free() - 'classes' with constructor and destructor semantics for scope-based resource management. - lock guards based on the above classes. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/20230612093537.614161713%40infradead.org