From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 2F3DAA0567;
	Wed, 10 Mar 2021 15:01:24 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id E10BE22A387;
	Wed, 10 Mar 2021 15:01:15 +0100 (CET)
Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com
 [64.147.123.21])
 by mails.dpdk.org (Postfix) with ESMTP id CD01222A347
 for <dev@dpdk.org>; Wed, 10 Mar 2021 15:01:14 +0100 (CET)
Received: from compute5.internal (compute5.nyi.internal [10.202.2.45])
 by mailout.west.internal (Postfix) with ESMTP id AF85D1977;
 Wed, 10 Mar 2021 09:01:13 -0500 (EST)
Received: from mailfrontend2 ([10.202.2.163])
 by compute5.internal (MEProxy); Wed, 10 Mar 2021 09:01:13 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 from:to:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding; s=fm3; bh=I6P8vmLGIb3gp
 S5nvUqPF3ysdqqa4S4YeWZmARqsV9k=; b=a7TUzfrQg320F3rvxySv+ThXuzhY0
 nF3dCnP//c6ktj0CE4eV665BKqjh2WiZQgJXYQV+T/szeV+850bCaABo7/I5JG5A
 FMXtCkzdcfcrQ7vkgyKS+85dSLjujqn2D7g4JF/JTRUv/S+KstAno+uDBgWlNTGO
 nL+65cR+KXul0SczUURfl2JRjw3DSGaxXMjEJdYCJbERM03XuDp9gydjjKsyd5VX
 zKlCMmbCW+OhYlfIugIMoIvvMWqORmUlzWeIoGgnD/M8TR+izmYD6Sn1NfDbQbCn
 9i7EBFZ0kdSlymFqJGblKDq5OvZZAJ9T+6LVVCjN61aYRY7NvCm5QUdaQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=content-transfer-encoding:date:from
 :in-reply-to:message-id:mime-version:references:subject:to
 :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=
 fm2; bh=I6P8vmLGIb3gpS5nvUqPF3ysdqqa4S4YeWZmARqsV9k=; b=QhsY1eUj
 wuN7Qn8wXWYoiSC4xwHsIuLIRuasvNwJZNbfEzBMs+lWBqvO0S5Ls14h2Cgyjhmm
 Pm7EzvEi2GGqDsF16i674Tif6l0nk0/MXqWjaLDqMp/GxZuWSkozmuoi3DnBsEKg
 bM2ucLKVBSArikOL8zYTmG6H13njO5+JtpZZokN0urNSlTdESeI2PDBXpp3ekk6K
 CRO5pk+Tq2+hteTLyQGdXSM0EJlMjouiOubnUtmUurLbG1Li8z7026UK0KQRjym6
 kmolXMYqfLHCmpMjyLPc4Jhdylmn5CAY6MATJThzCNj7WZHsXoKAFkmI3bG2SJXu
 +LDX5sOIDzZY3w==
X-ME-Sender: <xms:KNFIYLmTFgFM4E2ddkP8NHeiTAShtvrcTRCw-rOQjm89OGO2YwdtFA>
 <xme:KNFIYOycVsTlXuXI8vaWEVqyVQ1l_MmIW-Yimr6id6A3Sn9ZmGy49F3jtUfVz_C0R
 R8XliMFFQ7evj2D3A>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledruddukedgheelucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre
 dtredttdenucfhrhhomhepvfhhohhmrghsucfoohhnjhgrlhhonhcuoehthhhomhgrshes
 mhhonhhjrghlohhnrdhnvghtqeenucggtffrrghtthgvrhhnpedvhefgiedvjeegtdevhe
 efhfetleefgfeivefgffevfeejgedtgfeutdehtdegveenucfkphepjeejrddufeegrddv
 tdefrddukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh
 homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth
X-ME-Proxy: <xmx:KNFIYOjNkVwzKtkXQiNrrEjhjZjQhGbeWS4FzlxIQtqyq3wqcKMndA>
 <xmx:KNFIYLUIniwCRjPq52ZDEFf8ZwEbBmqnP6VG9qFyjR2wMDf633y9sQ>
 <xmx:KNFIYI1c9wZGnkQ-MYrfkxSI--PjLpMzk_wfgbk0w64OL0tAHMiqhg>
 <xmx:KdFIYNroR7rzXyNlAkWsFNblXXRp_AZRvg1oLrJHBI2vbmoLOdIx5g>
Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id 9FB1D1080063
 for <dev@dpdk.org>; Wed, 10 Mar 2021 09:01:12 -0500 (EST)
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Date: Wed, 10 Mar 2021 15:01:05 +0100
Message-Id: <20210310140107.2730088-2-thomas@monjalon.net>
X-Mailer: git-send-email 2.30.1
In-Reply-To: <20210310140107.2730088-1-thomas@monjalon.net>
References: <20210310140107.2730088-1-thomas@monjalon.net>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH 1/3] log: choose EAL log type on registration
 failure
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

In the unlikely case where something goes wrong
while registering a log type,
the fallback is to use the log type 0, assigned to EAL.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/librte_eal/include/rte_log.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_eal/include/rte_log.h b/lib/librte_eal/include/rte_log.h
index e6192892c3..178a265c3f 100644
--- a/lib/librte_eal/include/rte_log.h
+++ b/lib/librte_eal/include/rte_log.h
@@ -392,6 +392,7 @@ RTE_INIT(__##type)							\
 {									\
 	type = rte_log_register_type_and_pick_level(RTE_STR(name),	\
 						    RTE_LOG_##level);	\
+	type = RTE_MAX(0, type);                                        \
 }
 
 #ifdef __cplusplus
-- 
2.30.1