linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH v2 4/6] libtracefs: Combine allocate and create APIs into one
Date: Wed, 11 Nov 2020 20:26:30 -0500	[thread overview]
Message-ID: <20201111202630.18e3dd35@oasis.local.home> (raw)
In-Reply-To: <20201110122249.911664-5-tz.stoyanov@gmail.com>

On Tue, 10 Nov 2020 14:22:47 +0200
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:
>  tracefs_instance_get_file(struct tracefs_instance *instance, const char *file);
> diff --git a/lib/trace-cmd/trace-timesync.c b/lib/trace-cmd/trace-timesync.c
> index 35a41394..397487e5 100644
> --- a/lib/trace-cmd/trace-timesync.c
> +++ b/lib/trace-cmd/trace-timesync.c
> @@ -235,16 +235,15 @@ static int get_vsocket_params(int fd, unsigned int *lcid, unsigned int *lport,
>  static struct tracefs_instance *
>  clock_synch_create_instance(const char *clock, unsigned int cid)
>  {
> -	struct tracefs_instance *instance;
> +	struct tracefs_instance *instance = NULL;

Why set instance to NULL? It gets assigned a value in the second line.

-- Steve

>  	char inst_name[256];
>  
>  	snprintf(inst_name, 256, "clock_synch-%d", cid);
>  
> -	instance = tracefs_instance_alloc(inst_name);
> +	instance = tracefs_instance_create(inst_name);
>  	if (!instance)
>  		return NULL;
>  
> -	tracefs_instance_create(instance);
>  	tracefs_instance_file_write(instance, "trace", "\0");
>  	if (clock)
>  		tracefs_instance_file_write(instance, "trace_clock", clock);

  reply	other threads:[~2020-11-12  1:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10 12:22 [PATCH v2 0/6] libtracefs fixes and improvements Tzvetomir Stoyanov (VMware)
2020-11-10 12:22 ` [PATCH v2 1/6] trace-cmd: Change tracefs.h include path Tzvetomir Stoyanov (VMware)
2020-11-10 12:22 ` [PATCH v2 2/6] libtracefs: Change APIs to work with constant strings Tzvetomir Stoyanov (VMware)
2020-11-11 22:43   ` Steven Rostedt
2020-11-11 22:43     ` Steven Rostedt
2020-11-10 12:22 ` [PATCH v2 3/6] libtracefs: Add new API to check if instance exists Tzvetomir Stoyanov (VMware)
2020-11-10 12:22 ` [PATCH v2 4/6] libtracefs: Combine allocate and create APIs into one Tzvetomir Stoyanov (VMware)
2020-11-12  1:26   ` Steven Rostedt [this message]
2020-11-10 12:22 ` [PATCH v2 5/6] libtracefs: Add new tracefs API tracefs_instances_walk() Tzvetomir Stoyanov (VMware)
2020-11-12  1:31   ` Steven Rostedt
2020-11-12  5:01     ` Tzvetomir Stoyanov
2020-11-10 12:22 ` [PATCH v2 6/6] trace-cmd: Add new libtrasefs API to get the current trace clock Tzvetomir Stoyanov (VMware)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201111202630.18e3dd35@oasis.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=tz.stoyanov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).