Will sparse ever work correctly with guard?
Jeff Johnson <[email protected]>
| Newsgroups | org.kernel.vger.linux-sparse,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
In code I maintain there are places where we are now trying to use guard to cleanup locks. But 'make W=1 C=1' is complaining: warning: context imbalance in '<function>' - wrong count at exit And lore shows this is not a new complaint: [PATCH v2] parse: handle __cleanup__ attribute https://lore.kernel.org/all/[email protected]/ For some reason scoped_guard doesn't have this issue: Re: [PATCH v1 3/3] cgroup: add lock guard support for others https://lore.kernel.org/all/[email protected]/ But using scoped_guard then requires an additional level of indentation in the code. So I'm wondering if there is any chance that sparse will be able to handle guard in the same manner as scoped_guard? The code I maintain currently has no sparse issues, so if this cannot be fixed then I'll have to decide whether to use scoped_guard (and indent the body of those functions) or just keep the traditional "goto cleanup" code. /jeff