devargs: fix freeing during device removal
[dpdk.git] / drivers / net / mlx5 / mlx5_socket.c
index e12c4cb..a3a5229 100644 (file)
@@ -35,6 +35,12 @@ mlx5_socket_init(struct rte_eth_dev *dev)
        int ret;
        int flags;
 
+       /*
+        * Close the last socket that was used to communicate
+        * with the secondary process
+        */
+       if (priv->primary_socket)
+               mlx5_socket_uninit(dev);
        /*
         * Initialise the socket to communicate with the secondary
         * process.
@@ -294,7 +300,7 @@ mlx5_socket_connect(struct rte_eth_dev *dev)
        }
        ret = *fd;
        close(socket_fd);
-       return 0;
+       return ret;
 error:
        if (socket_fd != -1)
                close(socket_fd);