net/nfp: check returned value
Checks
Commit Message
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
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)
@@ -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;
}