Most static checker stuff is cleanup code. I've written a blog entry on clean up code. https://staticthinking.wordpress.com/2022/04/28/free-the-last-thing-style/ You mostly get this right, but one thing which could help is rule #6 where ideally the cleanup in the function is copy and pasted to create the release function. So when you add cleanup to the error paths, check the release function and see what it does. Sometimes you've seen the clean up code is missing in the release function. Other times it calls wrapper like gpio_put_device() instead of calling put_device() directly. The function calls should be in a specific order, (hopefully the reverse order of how they're allocated). regards, dan carpenter