raw/ifpga/base: dereference before null check

Message ID 20190917222459.19097-1-tianfei.zhang@intel.com
State New
Headers show
Series
  • raw/ifpga/base: dereference before null check
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/mellanox-Performance success Performance Testing PASS
ci/intel-Performance success Performance Testing PASS
ci/iol-dpdk_compile_spdk success Compile Testing PASS
ci/iol-dpdk_compile success Compile Testing PASS
ci/iol-dpdk_compile_ovs success Compile Testing PASS
ci/checkpatch success coding style OK

Commit Message

Zhang, Tianfei Sept. 17, 2019, 10:24 p.m.
Add pointer null check before dereference.

Coverity issue: 344976
Fixes: 12f92a51 ("raw/ifpga/base: fix retimer link status")
Cc: stable@dpdk.org

Signed-off-by: Tianfei zhang <tianfei.zhang@intel.com>
---
 drivers/raw/ifpga/base/opae_eth_group.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch

diff --git a/drivers/raw/ifpga/base/opae_eth_group.c b/drivers/raw/ifpga/base/opae_eth_group.c
index d189dd578..be28954e0 100644
--- a/drivers/raw/ifpga/base/opae_eth_group.c
+++ b/drivers/raw/ifpga/base/opae_eth_group.c
@@ -308,9 +308,8 @@  struct eth_group_device *eth_group_probe(void *base)
 
 void eth_group_release(struct eth_group_device *dev)
 {
-	eth_group_hw_uinit(dev);
-
 	if (dev) {
+		eth_group_hw_uinit(dev);
 		dev->status = ETH_GROUP_DEV_NOUSED;
 		opae_free(dev);
 	}