trace-cmd record: Remove redundant check of instance in allocate_instance()
PATCH 1/1 trace-cmd record: Remove redundant check of instance in allocate_instance()
From: "Steven Rostedt (Google)" <[email protected]>
The error path only happens after the instance has been allocated. No need to check if it exists again.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=217127
--- tracecmd/trace-record.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
tracecmd/trace-record.c +3 -5
@@ -387,11 +387,9 @@ struct buffer_instance *allocate_instance(const char *name)return instance; error: -if (instance) { -free (instance->name); -tracefs_instance_free (instance->tracefs); -free (instance); - } +free (instance->name); +tracefs_instance_free (instance->tracefs); +free (instance);return NULL ; }
Signature · 1 line
2.39.2
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · On Fri, 2 Jun 2023 15:12:11 +0200 Markus Elfring <[email protected]> wrote:
Quoted 4 lines
The error path only happens after the instance has been allocated. No need to check if it exists again.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=217127
Will it be more appropriate to refer to an other bug report here?
I first wasn't going to bother with it, but then I started modifying code around it where you mention this in the above mentioned bug, and tagged that one. I can modify it to have you original one (I'll do that internally, not with a v2).
Quoted 8 lines
2023-03-04
Improve exception handling inallocate_instance()
https://bugzilla.kernel.org/show_bug.cgi?id=217128Will any additional adjustments become helpful for jump targets in this function implementation?
No need to spend cycles on this. It's a very slow path. Optimizing it is nothing more than an academic exercise.
-- Steve