From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id 2A5C51BEC0 for ; Thu, 5 Jul 2018 13:49:00 +0200 (CEST) Received: by mail-wm0-f47.google.com with SMTP id w16-v6so10583912wmc.2 for ; Thu, 05 Jul 2018 04:49:00 -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; bh=V8N2JaBZxbM/kmNjb6RWPhqNiLeLC838ugWs18AVS7I=; b=f5N5RYKfxKvp2uEsiPiqmG5RV9SqaELr3P8F58Ou/dk9xPjkMJvxIW1tKGMSW+Ypo2 NlwVzUc9n60nnS8TW6GVmq8FbQ0CR617OSV7dhM5CdD/GQ7044WFXUBwaGPd1CdXIeMx luT8CjcjLreQkHtXKTL7Rm3/SKkDUqEXoX9caLFNuP2YuOkB6CwWY4uOhKPaGGxd0URl 6PzlWmTq9glXAMVqKe+9HMVWwEglRiFoS5LO+Fjmkh+v8HizAIwREgn1piDoi6m/St48 SCua0XypPfe8BeAV6jZltYky/qkdK5UY7eb6/tesVPQjSb78BligS9RlvOD5WOf95Ki7 VfgQ== 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; bh=V8N2JaBZxbM/kmNjb6RWPhqNiLeLC838ugWs18AVS7I=; b=DZiY2U1uEs86fQdZY5rAuVSJxJWz+prUm0QXjjCeE9gDa60k68cm/pCHArJmVqs8Bh Hs3wnt3N57Ag6WUIZrUoZAU4V9mWBs6hc8UZsqCkTe7mIoLudlg/Jq2VhGiqK+qijGf9 TZgece1H4LmHvu+ZfjJcsWf9y2v8zWjj0XMykXjuRYb0uG6/iBtcavMmJ58Dtj7tIr9J 2so/AxnZjU8pKub2M4LYPKo3MzKlmrEh2pRH2VyTVbmts2E8HBr6PFP87spt4Lm8ezsu uf3WaQANkyOUMzjtmHUss7AxqAASk45sJS1jXk/VllGf4q9tiQ2oMGLSuW27U1Wl3TG+ zOPQ== X-Gm-Message-State: APt69E32GZ6qdDbbFNKHyF25T/DLp6iFxDrV6Ih6EUABnCGv3GDGQAxL XPKmSA1Px0oWC5cnbNk3lFVJuNti X-Google-Smtp-Source: AAOMgpfXPlLaG+KuhWi0OdqXWut79WIkBsOqHDInZVdho8n85dHkYw/hbBZK0BUQhWU92PWPyhAeNw== X-Received: by 2002:a1c:b590:: with SMTP id e138-v6mr4074808wmf.154.1530791339252; Thu, 05 Jul 2018 04:48:59 -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 o42-v6sm15809183wrc.50.2018.07.05.04.48.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jul 2018 04:48:58 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 5 Jul 2018 13:48:09 +0200 Message-Id: <219ee773c228fc32b7213bca5073258008126a38.1530791217.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v10 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: Thu, 05 Jul 2018 11:49:00 -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.18.0