From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by dpdk.org (Postfix) with ESMTP id B6BBD1BE1D for ; Wed, 4 Jul 2018 00:15:36 +0200 (CEST) Received: by mail-wm0-f52.google.com with SMTP id p11-v6so3723194wmc.4 for ; Tue, 03 Jul 2018 15:15:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=o05wWIBefdI3lkZ64u5iCyqaWgbiAT5ocS/Pprxx5hI=; b=mdw+xlma3cEjaneIFfxHNtrPZ7vCG2p9hgVevtdO7+psCmLq63pCZE0AXM2t8eR62b CdoBTzj16tT5L0byZ2F7mPE/jFbtx54hZndVIn3OmvvBY4zYUO7uzKJsdHgNE9jmkdol e/rfhc6nJecfhg+bIraHt9Kim/IX4/1Hf5SHTWk0cZW7T6SYiXQY5JpyexxeX0kSIZ9g FJ8eEtBIPwatEKk+w/E6khJcNTJh2jprUQ0cze7ihMrcJFkC91t94Djx055mVQFyKRuZ fV6MiQVDmQdShzitgRyOs7yJCcDy+NMZQp4Kt4fUBR6kqQiG50Z7NonEVDb07EGHZIsw UjKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=o05wWIBefdI3lkZ64u5iCyqaWgbiAT5ocS/Pprxx5hI=; b=qMWFeH34vrsZbBpfXCNexUJ6yPM1WfuZ68NahsB6zwHELZmm6aOSPWUCziCsg0A4eB BZBEK3SlmR9+GCQQyGlF2rggexTu1ThuNS9kIU3z1lEmtl2iLV/md8gtS00rnRHTEgjd w1Myx9Bra75VU7QMCOKz6NITpbGS/6ZJQMmndBpPkiJoSMqWGYWSoJnp3RpJZ+bMdBP0 Xr1YlgXpTWL+/bPCpj271n1auCgQ0fmgsuJXU/ZM7jJ/M5EJDTM+qxhU4S4i4UK2MVOR rAH3PRw1sASAAqf6i8WowEQ6wmTiZ6y30T3UthXqzFp1XS9JPl1+nCOZ+UnIymvwoK4q PJXA== X-Gm-Message-State: APt69E05a1tYVZu80fxKJB7Ps5DuV4cwN50IUvJdqtvL9SFE0U1N4OCx ECeXyacdwOkCoGFWn9+2f4J0o6S5 X-Google-Smtp-Source: AAOMgpfPWfI5R4AMPEwX5xwfiImxzaNulgTJG2TWab9vj46b5MsDpvXVgHji01MNqMk995pCkjEIgw== X-Received: by 2002:a1c:e541:: with SMTP id c62-v6mr9358041wmh.154.1530656136037; Tue, 03 Jul 2018 15:15:36 -0700 (PDT) Received: from bidouze.dev.6wind.com. (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id i190-v6sm3771084wmd.33.2018.07.03.15.15.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jul 2018 15:15:35 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 4 Jul 2018 00:14:45 +0200 Message-Id: <219ee773c228fc32b7213bca5073258008126a38.1530655929.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v9 02/27] kvargs: remove error logs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2018 22:15:37 -0000 Error logs in kvargs parsing should be better handled in components calling the library. This library must be as lean as possible. Signed-off-by: Gaetan Rivet --- lib/librte_kvargs/rte_kvargs.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/lib/librte_kvargs/rte_kvargs.c b/lib/librte_kvargs/rte_kvargs.c index d92a5f9dc..747f14964 100644 --- a/lib/librte_kvargs/rte_kvargs.c +++ b/lib/librte_kvargs/rte_kvargs.c @@ -6,7 +6,6 @@ #include #include -#include #include #include "rte_kvargs.h" @@ -28,29 +27,22 @@ rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *params) * to pass to rte_strsplit */ kvlist->str = strdup(params); - if (kvlist->str == NULL) { - RTE_LOG(ERR, PMD, "Cannot parse arguments: not enough memory\n"); + if (kvlist->str == NULL) return -1; - } /* browse each key/value pair and add it in kvlist */ str = kvlist->str; while ((str = strtok_r(str, RTE_KVARGS_PAIRS_DELIM, &ctx1)) != NULL) { i = kvlist->count; - if (i >= RTE_KVARGS_MAX) { - RTE_LOG(ERR, PMD, "Cannot parse arguments: list full\n"); + if (i >= RTE_KVARGS_MAX) return -1; - } kvlist->pairs[i].key = strtok_r(str, RTE_KVARGS_KV_DELIM, &ctx2); kvlist->pairs[i].value = strtok_r(NULL, RTE_KVARGS_KV_DELIM, &ctx2); - if (kvlist->pairs[i].key == NULL || kvlist->pairs[i].value == NULL) { - RTE_LOG(ERR, PMD, - "Cannot parse arguments: wrong key or value\n" - "params=<%s>\n", params); + if (kvlist->pairs[i].key == NULL || + kvlist->pairs[i].value == NULL) return -1; - } kvlist->count++; str = NULL; @@ -89,12 +81,8 @@ check_for_valid_keys(struct rte_kvargs *kvlist, for (i = 0; i < kvlist->count; i++) { pair = &kvlist->pairs[i]; ret = is_valid_key(valid, pair->key); - if (!ret) { - RTE_LOG(ERR, PMD, - "Error parsing device, invalid key <%s>\n", - pair->key); + if (!ret) return -1; - } } return 0; } -- 2.11.0