raw/ifpga/base: fix dereference before null check
authorTianfei Zhang <tianfei.zhang@intel.com>
Tue, 17 Sep 2019 22:24:59 +0000 (06:24 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 25 Oct 2019 17:23:22 +0000 (19:23 +0200)
Add pointer null check before dereference.

Coverity issue: 344976
Fixes: 12f92a513a13 ("raw/ifpga/base: fix retimer link status")
Cc: stable@dpdk.org
Signed-off-by: Tianfei Zhang <tianfei.zhang@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
drivers/raw/ifpga/base/opae_eth_group.c

index d189dd5..be28954 100644 (file)
@@ -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);
        }