From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E8020A0A02; Tue, 6 Apr 2021 11:25:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 749D1140FCA; Tue, 6 Apr 2021 11:25:57 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 01781406A2 for ; Tue, 6 Apr 2021 11:25:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617701155; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=91PH9f5jKYlTDTxpQie7/IUEynazbFrEqGKaszg87ow=; b=VVZJgUrfb2gsxJjB+PhAliClLzz4e4P7KOT1IMFdfpnxxaYNMsxLWS7IBipyX5E2DpdT11 QoEvsX1NY4h5baYaoP9djt/+1SjObVXjicL9h1WMujzgUkcxF/1DbkzPjtWTn4lIs3UavT foRPF43bJjxGXfp53UuQb1fEdye9aqo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-2-VhYpN9QTPImMWYLaELrkcg-1; Tue, 06 Apr 2021 05:25:53 -0400 X-MC-Unique: VhYpN9QTPImMWYLaELrkcg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 667E7107ACCA; Tue, 6 Apr 2021 09:25:52 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.193.239]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B2BC19C45; Tue, 6 Apr 2021 09:25:51 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Bruce Richardson , Ciara Power Date: Tue, 6 Apr 2021 11:25:45 +0200 Message-Id: <20210406092545.24465-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-dev] [PATCH] eal: fix telemetry logtype registration X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" rte_log_register_type_and_pick_level() returns an int. Casting to a uin32_t will make us miss the -1 passed in case of failure. Fixes: 37b881a96194 ("telemetry: use log function from pointer") Signed-off-by: David Marchand --- lib/librte_eal/freebsd/eal.c | 4 +++- lib/librte_eal/linux/eal.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c index 32442e5ba6..5544701f20 100644 --- a/lib/librte_eal/freebsd/eal.c +++ b/lib/librte_eal/freebsd/eal.c @@ -941,8 +941,10 @@ rte_eal_init(int argc, char **argv) return -1; } if (!internal_conf->no_telemetry) { - uint32_t tlog = rte_log_register_type_and_pick_level( + int tlog = rte_log_register_type_and_pick_level( "lib.telemetry", RTE_LOG_WARNING); + if (tlog < 0) + tlog = RTE_LOGTYPE_EAL; if (rte_telemetry_init(rte_eal_get_runtime_dir(), rte_version(), &internal_conf->ctrl_cpuset, rte_log, tlog) != 0) diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c index abbb537746..9b47fef6f8 100644 --- a/lib/librte_eal/linux/eal.c +++ b/lib/librte_eal/linux/eal.c @@ -1314,8 +1314,10 @@ rte_eal_init(int argc, char **argv) return -1; } if (!internal_conf->no_telemetry) { - uint32_t tlog = rte_log_register_type_and_pick_level( + int tlog = rte_log_register_type_and_pick_level( "lib.telemetry", RTE_LOG_WARNING); + if (tlog < 0) + tlog = RTE_LOGTYPE_EAL; if (rte_telemetry_init(rte_eal_get_runtime_dir(), rte_version(), &internal_conf->ctrl_cpuset, rte_log, tlog) != 0) -- 2.23.0