From patchwork Wed Nov 21 15:14:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10759831 Return-Path: Received: from mail-eopbgr790053.outbound.protection.outlook.com ([40.107.79.53]:64832 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730512AbeKVBtP (ORCPT ); Wed, 21 Nov 2018 20:49:15 -0500 From: Yordan Karadzhov To: "rostedt@goodmis.org" CC: "linux-trace-devel@vger.kernel.org" Subject: [PATCH 02/11] kernel-shark-qt: Fix the returned error value of kshark_get_event_id_easy() Date: Wed, 21 Nov 2018 15:14:20 +0000 Message-ID: <20181121151356.16901-4-ykaradzhov@vmware.com> References: <20181121151356.16901-1-ykaradzhov@vmware.com> In-Reply-To: <20181121151356.16901-1-ykaradzhov@vmware.com> Content-Language: en-US MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org List-ID: This patch fixes a simple bug in kshark_get_event_id_easy(). All returned error codes must be negative. Signed-off-by: Yordan Karadzhov --- kernel-shark-qt/src/libkshark.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel-shark-qt/src/libkshark.c b/kernel-shark-qt/src/libkshark.c index 1a39968..fa85171 100644 --- a/kernel-shark-qt/src/libkshark.c +++ b/kernel-shark-qt/src/libkshark.c @@ -1111,7 +1111,7 @@ int kshark_get_event_id_easy(struct kshark_entry *entry) free_record(data); } - return (event_id == -1)? EFAULT : event_id; + return (event_id == -1)? -EFAULT : event_id; } /** @@ -1133,7 +1133,7 @@ const char *kshark_get_event_name_easy(struct kshark_entry *entry) struct tep_event_format *event; int event_id = kshark_get_event_id_easy(entry); - if (event_id == EFAULT) + if (event_id == -EFAULT) return NULL; kshark_instance(&kshark_ctx);