Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32ca678d authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf machine: Destructors should accept NULL

And do nothing, just like free(), to avoid having to test it in callers,
usually in error paths.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-q42gj3b3znhho9z1mrbo4jce@git.kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 61b3f66a
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -138,9 +138,11 @@ void machine__exit(struct machine *machine)

void machine__delete(struct machine *machine)
{
	if (machine) {
		machine__exit(machine);
		free(machine);
	}
}

void machines__init(struct machines *machines)
{
+2 −4
Original line number Diff line number Diff line
@@ -102,10 +102,8 @@ int init_probe_symbol_maps(bool user_only)

void exit_probe_symbol_maps(void)
{
	if (host_machine) {
	machine__delete(host_machine);
	host_machine = NULL;
	}
	symbol__exit();
}