[PATCH 3/4] perf session: Move an error code assignment in __perf_session__set_tracepoints_handlers()

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

 



From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 23 Jan 2017 15:43:13 +0100

A local variable was set to an error code before a concrete error situation
was detected. Thus move the corresponding assignment into an if branch
to indicate a software failure there.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
 tools/perf/util/session.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index f268201048a0..98605ad4affd 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -2050,10 +2050,10 @@ int __perf_session__set_tracepoints_handlers(struct perf_session *session,
 		evsel = perf_evlist__find_tracepoint_by_name(session->evlist, assocs[i].name);
 		if (evsel == NULL)
 			continue;
-
-		err = -EEXIST;
-		if (evsel->handler != NULL)
+		if (evsel->handler) {
+			err = -EEXIST;
 			goto out;
+		}
 		evsel->handler = assocs[i].handler;
 	}
 
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux