perf probe: Cleanup find_perf_probe_point_from_map to reduce redundancy
authorMasami Hiramatsu <[email protected]>
Fri, 6 Nov 2015 08:30:03 +0000 (17:30 +0900)
committerArnaldo Carvalho de Melo <[email protected]>
Fri, 6 Nov 2015 13:47:33 +0000 (10:47 -0300)
In find_perf_probe_point_from_map(), the 'ret' variable is initialized
with -ENOENT but overwritten by the return code of
kernel_get_symbol_address_by_name(), and after that it is re-initialized
with -ENOENT again.

Setting ret=-ENOENT twice looks a bit redundant. This avoids the
overwriting and just returns -ENOENT if some error happens to simplify
the code.

Signed-off-by: Masami Hiramatsu <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Wang Nan <[email protected]>
Cc: Zefan Li <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/util/probe-event.c

index e659c4faddec3c13f79cdf7eab1ed973f9934ce0..03875f9154e7562c060e5935d30bc65d6ba0973b 100644 (file)
@@ -1895,9 +1895,8 @@ static int find_perf_probe_point_from_map(struct probe_trace_point *tp,
                sym = map__find_symbol(map, addr, NULL);
        } else {
                if (tp->symbol && !addr) {
-                       ret = kernel_get_symbol_address_by_name(tp->symbol,
-                                                       &addr, true, false);
-                       if (ret < 0)
+                       if (kernel_get_symbol_address_by_name(tp->symbol,
+                                               &addr, true, false) < 0)
                                goto out;
                }
                if (addr) {
@@ -1906,8 +1905,6 @@ static int find_perf_probe_point_from_map(struct probe_trace_point *tp,
                }
        }
 
-       /* ret may has be overwritten so reset it */
-       ret = -ENOENT;
        if (!sym)
                goto out;