From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from netronome.com (unknown [217.38.71.146]) by dpdk.org (Postfix) with ESMTP id DB3A82BD8; Mon, 8 Apr 2019 12:38:47 +0200 (CEST) Received: from netronome.com (localhost [127.0.0.1]) by netronome.com (8.15.2/8.15.2/Debian-10) with ESMTP id x38AclsG026759; Mon, 8 Apr 2019 11:38:47 +0100 Received: (from root@localhost) by netronome.com (8.15.2/8.15.2/Submit) id x38AclLF026758; Mon, 8 Apr 2019 11:38:47 +0100 From: Alejandro Lucero To: dev@dpdk.org Cc: stable@dpdk.org Date: Mon, 8 Apr 2019 11:38:47 +0100 Message-Id: <20190408103847.26713-1-alejandro.lucero@netronome.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] net/nfp: check returned value 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: Mon, 08 Apr 2019 10:38:48 -0000 If the call fails just returns 0. Coverity issue: 277225 Fixes: c7e9729da6b5 ("net/nfp: support CPP") Cc: stable@dpdk.org Signed-off-by: Alejandro Lucero --- drivers/net/nfp/nfpcore/nfp_cppcore.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/nfp/nfpcore/nfp_cppcore.c b/drivers/net/nfp/nfpcore/nfp_cppcore.c index 2ca4283c4..dec4a8b6d 100644 --- a/drivers/net/nfp/nfpcore/nfp_cppcore.c +++ b/drivers/net/nfp/nfpcore/nfp_cppcore.c @@ -811,8 +811,10 @@ __nfp_cpp_model_autodetect(struct nfp_cpp *cpp) /* The PL's PluDeviceID revision code is authoratative */ model &= ~0xff; - nfp_xpb_readl(cpp, NFP_XPB_DEVICE(1, 1, 16) + - NFP_PL_DEVICE_ID, &tmp); + if (nfp_xpb_readl(cpp, NFP_XPB_DEVICE(1, 1, 16) + + NFP_PL_DEVICE_ID, &tmp)) + return 0; + model |= (NFP_PL_DEVICE_ID_MASK & tmp) - 0x10; } -- 2.17.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 2EF38A0096 for ; Mon, 8 Apr 2019 12:38:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E48AF4C8F; Mon, 8 Apr 2019 12:38:49 +0200 (CEST) Received: from netronome.com (unknown [217.38.71.146]) by dpdk.org (Postfix) with ESMTP id DB3A82BD8; Mon, 8 Apr 2019 12:38:47 +0200 (CEST) Received: from netronome.com (localhost [127.0.0.1]) by netronome.com (8.15.2/8.15.2/Debian-10) with ESMTP id x38AclsG026759; Mon, 8 Apr 2019 11:38:47 +0100 Received: (from root@localhost) by netronome.com (8.15.2/8.15.2/Submit) id x38AclLF026758; Mon, 8 Apr 2019 11:38:47 +0100 From: Alejandro Lucero To: dev@dpdk.org Cc: stable@dpdk.org Date: Mon, 8 Apr 2019 11:38:47 +0100 Message-Id: <20190408103847.26713-1-alejandro.lucero@netronome.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] net/nfp: check returned value 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190408103847.6EJhI5UrqQMm25GVFwOIw_tBYF9IhWJzoyRF-QPQDYk@z> If the call fails just returns 0. Coverity issue: 277225 Fixes: c7e9729da6b5 ("net/nfp: support CPP") Cc: stable@dpdk.org Signed-off-by: Alejandro Lucero --- drivers/net/nfp/nfpcore/nfp_cppcore.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/nfp/nfpcore/nfp_cppcore.c b/drivers/net/nfp/nfpcore/nfp_cppcore.c index 2ca4283c4..dec4a8b6d 100644 --- a/drivers/net/nfp/nfpcore/nfp_cppcore.c +++ b/drivers/net/nfp/nfpcore/nfp_cppcore.c @@ -811,8 +811,10 @@ __nfp_cpp_model_autodetect(struct nfp_cpp *cpp) /* The PL's PluDeviceID revision code is authoratative */ model &= ~0xff; - nfp_xpb_readl(cpp, NFP_XPB_DEVICE(1, 1, 16) + - NFP_PL_DEVICE_ID, &tmp); + if (nfp_xpb_readl(cpp, NFP_XPB_DEVICE(1, 1, 16) + + NFP_PL_DEVICE_ID, &tmp)) + return 0; + model |= (NFP_PL_DEVICE_ID_MASK & tmp) - 0x10; } -- 2.17.1