net/mlx5: fix double free on error handling
[dpdk.git] / drivers / net / mlx5 / mlx5.c
index 3885b0b..05d4f02 100644 (file)
@@ -690,18 +690,18 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
                break;
        }
        if (attr_ctx == NULL) {
-               mlx5_glue->free_device_list(list);
                switch (err) {
                case 0:
                        DRV_LOG(ERR,
                                "cannot access device, is mlx5_ib loaded?");
                        err = ENODEV;
-                       goto error;
+                       break;
                case EINVAL:
                        DRV_LOG(ERR,
                                "cannot use device, are drivers up to date?");
-                       goto error;
+                       break;
                }
+               goto error;
        }
        ibv_dev = list[i];
        DRV_LOG(DEBUG, "device opened");