From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id B42FB1B50D for ; Wed, 11 Jul 2018 23:45:41 +0200 (CEST) Received: by mail-wr1-f67.google.com with SMTP id c13-v6so19557879wrt.1 for ; Wed, 11 Jul 2018 14:45:41 -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=0PfDbteb90dJZdNR95tgR1W4/MwSAauYE1N7bIOuOqQ=; b=z4Iq7irNhZeqpBVR4u5y/aa1+ucRCAfMPUoAvyf1hKz5E1CzeENZ/Q10hRPh4QnKIP RJY8j21j6eZzuMwXE8olAWPB5bf0AFQKPYbdV5Nkc+bXM7JT2Wvxinksks3iwBHen8CK QEwtNhCx1/VnPqnuAbudyMquXIyJsr64u3va3T5nZ3mH1iF1ExrGJ2fuBEwPVnkccI8N Ga+iMoP/U/Ignfm5ACFvjASakr6TmlwKuHJzDcvK+yStK1YC+uv87CQ3YBG8ymWri/6w ULL/anKbiMMgsygumG2qfxEBcHPUwPIYoO7vLfRryCcqWiGBtm64wGQYVMYbx+GhZJzc yymg== 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=0PfDbteb90dJZdNR95tgR1W4/MwSAauYE1N7bIOuOqQ=; b=fyKNBy1yUj0yGTH3Lf9t/aV9G0xQ/AC1XU6fs/kITFYFfdKXtzK5Nh0wdGwxJbGJOX cDPVmtq/XIy1B5Ubwtrxeb+HHBdaujrb4Kuokqxp9RO9wSSEAJGV/08OAY7d2KVEmR6r TPEaj/YBPv9eJ4v1Wn/zN6HK3uiOU/kSvAXMVi1/AaKIfYXwehTuLFGdjv7QFa9jz5FP WIp0JV8E7wgiqFEqNBorO2xIy2DqKhx6y9DM7vDfTrIgPHaHGSARqUZtRvnPsrDc7xsM WKw2k8ye7NwNj66WV1VAEnimbOp3h13krv25RIf+Y4SYJn5FU39PUhxWl6w2jioX8pC3 rJPA== X-Gm-Message-State: AOUpUlFYFJjW1E8Tx9E2mbWnmUJ3+aGMmL5NW8TQOCtH3liF3zQ+qrmR ELqkg1riDanb7y6ypWnm2twqvLvs X-Google-Smtp-Source: AAOMgpfCwNUeKveug50iGBlw7ZFcJF5XgrJpvlxQch7ZDw4CJfaYkmK111NihmunbUswXrM97uSIwg== X-Received: by 2002:adf:8e10:: with SMTP id n16-v6mr229983wrb.100.1531345541060; Wed, 11 Jul 2018 14:45:41 -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 h5-v6sm10550936wrr.19.2018.07.11.14.45.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 14:45:40 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 11 Jul 2018 23:44:53 +0200 Message-Id: <2b839e17ebd871c2832b68608988fb00f760892c.1531345404.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v11 03/25] 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: Wed, 11 Jul 2018 21:45:42 -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 Acked-by: Thomas Monjalon --- 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