From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 0FDA2A0588;
	Tue,  7 Apr 2020 14:09:19 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id E9EDF2BD8;
	Tue,  7 Apr 2020 14:09:18 +0200 (CEST)
Received: from mail-il1-f196.google.com (mail-il1-f196.google.com
 [209.85.166.196]) by dpdk.org (Postfix) with ESMTP id 820132B96
 for <dev@dpdk.org>; Tue,  7 Apr 2020 14:09:17 +0200 (CEST)
Received: by mail-il1-f196.google.com with SMTP id j9so2912582ilr.7
 for <dev@dpdk.org>; Tue, 07 Apr 2020 05:09:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=/TndwEj9fcgnVSGugOxUW5LHtHtAO4XuJWUah5olOZM=;
 b=g97uIdGRWGt9lQq0XqjcNmhpmgtm7nsjXvdifYXOB4amis/ovygIaT2dgw0b0TkCAs
 LBUFWMQ8G+xP+a65BPcLAV9o45An5KGeKAKAp6sD36V5g3P9OEq5WWv4w+fB8M65MEnM
 b2q0XcXopT0XXeJOgJS/S2a4ctlkHsbAmw73PODmR2QkbYueoQ0gvQcsYvckW1FlOGaz
 ZsEwP8NrJZGk5HG2wWLxbfTruhuz3iiGyhVPnyUDTM2dLjpjBVCdMb7nqNMpdHQkqiDT
 rbiyLhJzhZaGHtrjwkLtnDz4q8yYjOsU3i3C49TvI+H6Y1bYfvQeTpyZGgZ17VyHOPzD
 72UA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=/TndwEj9fcgnVSGugOxUW5LHtHtAO4XuJWUah5olOZM=;
 b=hSsTpDulYXgAbJJcBfSwkPVXek5exvrYJj+NpCmDFzC5nwgDnSGaECMAnjX+y3Ax8p
 1aRii9LFiGMN87TTon/dzBa9XrazWgsKXKbHQMm/CiLFG6w7etyo4WCqWjRmRmJ2VvE5
 uBZcIKJWXD4X49nmUu84xnO81mGaZXiRfGKjLo/+02g0Q3TrCNZMXUftk5hCQY/iKs0I
 FhtMbCUv3dNQqDaAXOrsBZGrc2cXGV7bVrRyb+soiLb/RMMIMTcfIgZnHcRtfNRycWzU
 5uSDaqKiZPtUEUMcT6wrfowBbqTfzWnXyVTaR7LZYkbgXs+9xgA4sxNNRXsRvDyUcSTB
 7u2Q==
X-Gm-Message-State: AGi0Pua4uu8spA8rjqTyDLXNGBD/Kp2XLHFZT0M0Kwq/44O52u5xM3TD
 IChzBftB2Ce+uedrlJrToGL8w4GhQoGNmi8i6xI=
X-Google-Smtp-Source: APiQypKM4TsGvZbwSFomm9gbvIqQoKYayfrBMYLYJU5dsiXoNI6Wc0278DLsfB3X11DbopdK867sXqez9oPMePiU7eM=
X-Received: by 2002:a92:48cb:: with SMTP id j72mr2090696ilg.162.1586261356627; 
 Tue, 07 Apr 2020 05:09:16 -0700 (PDT)
MIME-Version: 1.0
References: <20200331192945.2466880-1-jerinj@marvell.com>
 <20200405085613.1336841-1-jerinj@marvell.com>
 <20200405085613.1336841-5-jerinj@marvell.com>
 <020f8ab9-71e7-b5af-926f-ab52cc342fd4@semihalf.com>
 <CALBAE1MNaJxh7aJSJ_s0ux7bT8Xr-oEn7k3FM-UrW1d02nrT3w@mail.gmail.com>
 <fe4ea601-b402-a915-52d5-fb21d8e7dbc1@semihalf.com>
In-Reply-To: <fe4ea601-b402-a915-52d5-fb21d8e7dbc1@semihalf.com>
From: Jerin Jacob <jerinjacobk@gmail.com>
Date: Tue, 7 Apr 2020 17:39:00 +0530
Message-ID: <CALBAE1NU-__XwzrQVp5HzAVffXtUWLqD_9PHn7vmnYwLEQ+uoA@mail.gmail.com>
To: Andrzej Ostruszka <amo@semihalf.com>
Cc: Jerin Jacob <jerinj@marvell.com>, Kiran Kumar K <kirankumark@marvell.com>,
 dpdk-dev <dev@dpdk.org>, Thomas Monjalon <thomas@monjalon.net>,
 David Marchand <david.marchand@redhat.com>, Ray Kinsella <mdr@ashroe.eu>,
 =?UTF-8?Q?Mattias_R=C3=B6nnblom?= <mattias.ronnblom@ericsson.com>, 
 Pavan Nikhilesh <pbhagavatula@marvell.com>,
 Nithin Dabilpuram <ndabilpuram@marvell.com>, 
 Xiao Wang <xiao.w.wang@intel.com>
Content-Type: text/plain; charset="UTF-8"
Subject: Re: [dpdk-dev] [PATCH v4 04/29] graph: implement node debug routines
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
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>

On Tue, Apr 7, 2020 at 5:20 PM Andrzej Ostruszka <amo@semihalf.com> wrote:
>
> On 4/7/20 12:22 PM, Jerin Jacob wrote:
> > On Mon, Apr 6, 2020 at 11:47 PM Andrzej Ostruszka <amo@semihalf.com> wrote:
> >>
> >> On 4/5/20 10:55 AM, jerinj@marvell.com wrote:
> >>> From: Jerin Jacob <jerinj@marvell.com>
> >>>
> >>> Adding node debug API implementation support to dump
> >>> single or all the node objects to the given file.
> >>>
> >>> Signed-off-by: Jerin Jacob <jerinj@marvell.com>
> >>> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> >>> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> >>> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> >> [...]
> >>> diff --git a/lib/librte_graph/node.c b/lib/librte_graph/node.c
> >>> index d04a0fce0..8592c1221 100644
> >>> --- a/lib/librte_graph/node.c
> >>> +++ b/lib/librte_graph/node.c
> >>> @@ -377,6 +377,38 @@ rte_node_edge_get(rte_node_t id, char *next_nodes[])
> >>>       return rc;
> >>>  }
> >>>
> >>> +static void
> >>> +node_scan_dump(FILE *f, rte_node_t id, bool all)
> >>> +{
> >>> +     struct node *node;
> >>> +
> >>> +     RTE_ASSERT(f != NULL);
> >>
> >> Why the assert?  Below this is used in public (I guess) functions so
> >> user can provide wrong input - in that case I'd expect warning/error not
> >> an assert.
> >
> > Public API rte_node_dump() and node_scan_dump() calls this API without
> > any check.
>
> That was my point.  I would expect either there or here to have a check
> for arg instead of assert.  I'd say that asserts are very good for
> checking internal logic, but not so for checking if user input is OK.

All DPDK _dump() functions returns void. I thought, We will keep the same here.
Another option is. if it is NULL we can return.
i.e
-RTE_ASSERT(f != NULL);
+if (f == NULL)
+ return

Either scheme is OK with me, Let me know your preference, I will
change accordingly.

>
> But I'm fine if you ignore this.
>
> With regards
> Andrzej Ostruszka