* [PATCH] trace-cmd record: Remove redundant check of instance in allocate_instance()
@ 2023-06-02 8:01 Steven Rostedt
[not found] ` <325a00ce-72c0-bfbd-10b4-30db178500bb@web.de>
0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2023-06-02 8:01 UTC (permalink / raw)
To: Linux Trace Devel; +Cc: Markus Elfring
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
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
Reported-by: Markus Elfring <Markus.Elfring@web.de>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
tracecmd/trace-record.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index b094f0699a43..41d765b593b7 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -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;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] trace-cmd record: Remove redundant check of instance in allocate_instance()
[not found] ` <325a00ce-72c0-bfbd-10b4-30db178500bb@web.de>
@ 2023-06-03 4:09 ` Steven Rostedt
0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2023-06-03 4:09 UTC (permalink / raw)
To: Markus Elfring; +Cc: linux-trace-devel
On Fri, 2 Jun 2023 15:12:11 +0200
Markus Elfring <Markus.Elfring@web.de> wrote:
> > 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).
>
> 2023-03-04
> Improve exception handling in allocate_instance()
> https://bugzilla.kernel.org/show_bug.cgi?id=217128
>
>
> Will 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-03 4:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-02 8:01 [PATCH] trace-cmd record: Remove redundant check of instance in allocate_instance() Steven Rostedt
[not found] ` <325a00ce-72c0-bfbd-10b4-30db178500bb@web.de>
2023-06-03 4:09 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).