diff options
author | Matt Helsley <mhelsley@vmware.com> | 2019-07-31 11:24:15 -0700 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2019-08-31 12:19:40 -0400 |
commit | c97fea26254b284c93a67b788968622f9cc03b30 (patch) | |
tree | 9e527e732824fa37b2c0e8a5ee2ef04855a1c8aa /COPYING | |
parent | 2e63152bc1909e10b7bc844bbbef5a815f585b45 (diff) | |
download | linux-c97fea26254b284c93a67b788968622f9cc03b30.tar.gz linux-c97fea26254b284c93a67b788968622f9cc03b30.tar.bz2 linux-c97fea26254b284c93a67b788968622f9cc03b30.zip |
recordmcount: Remove redundant cleanup() calls
Redundant cleanup calls were introduced when transitioning from
the old error/success handling via setjmp/longjmp -- the longjmp
ensured the cleanup() call only happened once but replacing
the success_file()/fail_file() calls with cleanup() meant that
multiple cleanup() calls can happen as we return from function
calls.
In do_file(), looking just before and after the "goto out" jumps we
can see that multiple cleanups() are being performed. We remove
cleanup() calls from the nested functions because it makes the code
easier to review -- the resources being cleaned up are generally
allocated and initialized in the callers so freeing them there
makes more sense.
Other redundant cleanup() calls:
mmap_file() is only called from do_file() and, if mmap_file() fails,
then we goto out and do cleanup() there too.
write_file() is only called from do_file() and do_file()
calls cleanup() unconditionally after returning from write_file()
therefore the cleanup() calls in write_file() are not necessary.
find_secsym_ndx(), called from do_func()'s for-loop, when we are
cleaning up here it's obvious that we break out of the loop and
do another cleanup().
__has_rel_mcount() is called from two parts of do_func()
and calls cleanup(). In theory we move them into do_func(), however
these in turn prove redundant so another simplification step
removes them as well.
Link: http://lkml.kernel.org/r/de197e17fc5426623a847ea7cf3a1560a7402a4b.1564596289.git.mhelsley@vmware.com
Signed-off-by: Matt Helsley <mhelsley@vmware.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'COPYING')
0 files changed, 0 insertions, 0 deletions