Re: [PATCH v2 4/6] libtracefs: Combine allocate and create APIs into one

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 10 Nov 2020 14:22:47 +0200
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx> 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);



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux