net/nfp: check returned value

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

Checks

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

Commit Message

Alejandro Lucero April 8, 2019, 10:38 a.m. UTC
  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 <alejandro.lucero@netronome.com>
---
 drivers/net/nfp/nfpcore/nfp_cppcore.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Ferruh Yigit April 8, 2019, 4:32 p.m. UTC | #1
On 4/8/2019 11:38 AM, Alejandro Lucero wrote:
> 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 <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 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;
 	}