New upstream version 18.11-rc1
[deb_dpdk.git] / drivers / net / mlx4 / mlx4.c
index defc0d4..7f07b8d 100644 (file)
@@ -734,7 +734,6 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                eth_dev->data->mac_addrs = priv->mac;
                eth_dev->device = &pci_dev->device;
                rte_eth_copy_pci_info(eth_dev, pci_dev);
-               eth_dev->device->driver = &mlx4_driver.driver;
                /* Initialize local interrupt handle for current port. */
                priv->intr_handle = (struct rte_intr_handle){
                        .fd = -1,
@@ -782,12 +781,17 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                continue;
 port_error:
                rte_free(priv);
+               if (eth_dev != NULL)
+                       eth_dev->data->dev_private = NULL;
                if (pd)
                        claim_zero(mlx4_glue->dealloc_pd(pd));
                if (ctx)
                        claim_zero(mlx4_glue->close_device(ctx));
-               if (eth_dev)
+               if (eth_dev != NULL) {
+                       /* mac_addrs must not be freed because part of dev_private */
+                       eth_dev->data->mac_addrs = NULL;
                        rte_eth_dev_release_port(eth_dev);
+               }
                break;
        }
        /*