net/nfp: check value returned

Message ID 20190408095949.11236-1-alejandro.lucero@netronome.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/nfp: check value returned |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Alejandro Lucero April 8, 2019, 9:59 a.m. UTC
  Call to CPP read can fail.

Coverity issue: 277209
Fixes: c7e9729da6b5 ("net/nfp: support CPP")
Cc: stable@dpdk.org

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
---
 drivers/net/nfp/nfpcore/nfp_cppcore.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Ferruh Yigit April 8, 2019, 4:31 p.m. UTC | #1
On 4/8/2019 10:59 AM, Alejandro Lucero wrote:
> Call to CPP read can fail.
> 
> Coverity issue: 277209
> Fixes: c7e9729da6b5 ("net/nfp: support CPP")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>

Applied to dpdk-next-net/master, thanks.

(squashed with other return value check patches, since all are fixing same
commit there wouldn't be any backport concern)
  

Patch

diff --git a/drivers/net/nfp/nfpcore/nfp_cppcore.c b/drivers/net/nfp/nfpcore/nfp_cppcore.c
index 75d3c9748..2ca4283c4 100644
--- a/drivers/net/nfp/nfpcore/nfp_cppcore.c
+++ b/drivers/net/nfp/nfpcore/nfp_cppcore.c
@@ -801,7 +801,8 @@  __nfp_cpp_model_autodetect(struct nfp_cpp *cpp)
 	uint32_t arm_id = NFP_CPP_ID(NFP_CPP_TARGET_ARM, 0, 0);
 	uint32_t model = 0;
 
-	nfp_cpp_readl(cpp, arm_id, NFP6000_ARM_GCSR_SOFTMODEL0, &model);
+	if (nfp_cpp_readl(cpp, arm_id, NFP6000_ARM_GCSR_SOFTMODEL0, &model))
+		return 0;
 
 	if (NFP_CPP_MODEL_IS_6000(model)) {
 		uint32_t tmp;