From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BD9A9A054F; Tue, 16 Mar 2021 07:31:26 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 865FD4069F; Tue, 16 Mar 2021 07:31:26 +0100 (CET) Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) by mails.dpdk.org (Postfix) with ESMTP id 85C8440042 for ; Tue, 16 Mar 2021 07:31:24 +0100 (CET) Received: by mail-ed1-f54.google.com with SMTP id j3so20138266edp.11 for ; Mon, 15 Mar 2021 23:31:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GS7uSqBQAggYE2AvMZ4jmi28yRKci82V5FBMM7ryEIc=; b=FGlGkBPrFyUSy17ejGXvCb+4ITXeB4AR+cWsxdFboVDZRBZesdjJXipRtJG2gfiWSf psr3VCdQcwSUzRa/6zTlAvWi2ydoFYdLnhpY9VZ1Y1AtBBTKm2RaXHxFdYO2R8AaG6kn OpIMKq911QAyN4LGJNYwpP7P0seEYJvSOxzKo= 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=GS7uSqBQAggYE2AvMZ4jmi28yRKci82V5FBMM7ryEIc=; b=bGj46yETrkWW7KhVCVFEJFo2ogcdqA+oipJTXSrgwK9JKQs/mJv0dKAWo6fiPjFwTP kDHHsnX9sGkZ/muLQgAdGD3eK5W+l9qY3aRJ9GJsr/DmV0AUuM+yg0T7yYuLvouT2aPR NHoGmelG/B8U+Ky4iN2+vH23jueMnEzdsVmGZrMXfmy3EvyDXvVaBhMzFcefutcpNeAy +Msd6I6zeReEs6k0KYrAKKruOhsBmzYmUynbb7pBoeNj1fcWdXpAQ9rAFmrGuarwrGkG a2sduM3DcM9E8BhJUwaPnRYdn+wonr8YyfbSP8Sh2vLbMhRQNkoEhphGBwp4SXqoVNPM wX8w== X-Gm-Message-State: AOAM532L2ukOt0EMvaWmV0FNSPtPyUdHN1hH5kMs+bkrw+opix+IAyT5 /Wbw1pfFtJFkJDfVCCgiFJTswLxFEahrKz6Lf6neE0roPgaV2g== X-Google-Smtp-Source: ABdhPJzqJiaJPCLbALcn8YmBc9DytHXVVA4kcLrnRMxVH28DJIZ4bmMdQE3XZ8TuCda4n1vZursGwpBM/hqJKZm+dlU= X-Received: by 2002:a05:6402:1115:: with SMTP id u21mr34147243edv.383.1615876284124; Mon, 15 Mar 2021 23:31:24 -0700 (PDT) MIME-Version: 1.0 References: <20210316045518.20234-1-kalesh-anakkur.purayil@broadcom.com> In-Reply-To: From: Kalesh Anakkur Purayil Date: Tue, 16 Mar 2021 12:01:13 +0530 Message-ID: To: "Li, Xiaoyun" Cc: "dev@dpdk.org" , "Yigit, Ferruh" Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000ef33f605bda183c4" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix unchecked return value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" --000000000000ef33f605bda183c4 Content-Type: text/plain; charset="UTF-8" Hi Xiaoyun, Thank you for the suggestion. I have sent the updated patch. Regards, Kalesh On Tue, Mar 16, 2021 at 11:13 AM Li, Xiaoyun wrote: > Hi > > > -----Original Message----- > > From: Kalesh A P > > Sent: Tuesday, March 16, 2021 12:55 > > To: dev@dpdk.org > > Cc: Li, Xiaoyun ; Yigit, Ferruh < > ferruh.yigit@intel.com> > > Subject: [dpdk-dev] [PATCH] app/testpmd: fix unchecked return value > > > > From: Kalesh AP > > > > CID 353629 (#1 of 1): Unchecked return value (CHECKED_RETURN) > > check_return: Calling rte_eth_dev_info_get without checking return value > (as is > > done elsewhere 110 out of 117 times). > > You can just say "This patch checks return value for > rte_eth_dev_info_get() in show_macs()." > > > > > Coverity issue: 353629 > > > No need for this breaking line. Please see other examples for Coverity > issues. > > > Fixes: e1d44d0ad623 ("app/testpmd: show MAC addresses added to a port") > > Cc: stable@dpdk.org > > > > Signed-off-by: Kalesh AP > > --- > > app/test-pmd/config.c | 7 ++++++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index > > 576d5ac..ade26e0 100644 > > --- a/app/test-pmd/config.c > > +++ b/app/test-pmd/config.c > > @@ -4927,10 +4927,15 @@ show_macs(portid_t port_id) > > struct rte_ether_addr *addr; > > uint32_t i, num_macs = 0; > > struct rte_eth_dev *dev; > > + int ret; > > > > dev = &rte_eth_devices[port_id]; > > > > - rte_eth_dev_info_get(port_id, &dev_info); > > + ret = rte_eth_dev_info_get(port_id, &dev_info); > > + if (ret != 0) { > > + printf("rte_eth_dev_info_get() failed for port %u\n", > port_id); > > + return; > > + } > > You can use eth_dev_info_get_print_err(). Testpmd uses this function to > unify the err print. And only this place needs check, so you don't need to > define "ret". > Just the following is enough: > > if (eth_dev_info_get_print_err(port_id, &dev_info)) > return; > > BRs > Xiaoyun > > > > for (i = 0; i < dev_info.max_mac_addrs; i++) { > > addr = &dev->data->mac_addrs[i]; > > -- > > 2.10.1 > > -- Regards, Kalesh A P --000000000000ef33f605bda183c4--