]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
perf tools: No need to check if the argument to __get() function is NULL
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 24 May 2018 14:20:39 +0000 (11:20 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 4 Jun 2018 13:28:50 +0000 (10:28 -0300)
Those functions always check if the argument is NULL before trying to
grab a reference count, and also will return the received object, so, to
make code more compact, no need to check for NULL.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Krister Johansen <kjlx@templeofstupid.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-i9wycjdxh0fwhryu55lmafks@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-probe.c
tools/perf/util/hist.c

index c0065923a525fe474d2c28f94ee2042b64d3a080..99de91698de1e544a68a607ba11c1bc3fc08ba73 100644 (file)
@@ -81,8 +81,7 @@ static int parse_probe_event(const char *str)
                params.target_used = true;
        }
 
-       if (params.nsi)
-               pev->nsi = nsinfo__get(params.nsi);
+       pev->nsi = nsinfo__get(params.nsi);
 
        /* Parse a perf-probe command into event */
        ret = parse_perf_probe_command(str, pev);
index 4d602fba40b2d2b18614a290a779ae2f4cfb4d1a..95333b0681094db12c6196496c4395ba097792c6 100644 (file)
@@ -1039,7 +1039,7 @@ int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al,
        int err, err2;
        struct map *alm = NULL;
 
-       if (al && al->map)
+       if (al)
                alm = map__get(al->map);
 
        err = sample__resolve_callchain(iter->sample, &callchain_cursor, &iter->parent,