[dpdk-dev] [PATCH 3/6] net/mlx5: fix unnecessary init in socket handle

Michael Baum michaelba at mellanox.com
Wed May 27 10:37:54 CEST 2020


In the mlx5_pmd_socket_handle function it calls the recvmsg function
which returns the number of bytes read. The function assigns this return
value into a ret variable defined at the beginning of the function.
Similarly in the mlx5_pmd_socket_init function the it calls the socket
function which returns a file descriptor for the new socket. The
function also assigns this return value into a ret variable defined at
the beginning of the function.

In both functions they initialize the variable when defining it,
however, in both cases they do not use any ret variable before assigning
the return value from the function, so the initialization is
unnecessary.

Clean the aforementioned unnecessary initializations.

Fixes: e6cdc54cc0ef ("net/mlx5: add socket server for external tools")
Cc: stable at dpdk.org

Signed-off-by: Michael Baum <michaelba at mellanox.com>
Acked-by: Matan Azrad <matan at mellanox.com>
---
 drivers/net/mlx5/mlx5_socket.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_socket.c b/drivers/net/mlx5/mlx5_socket.c
index a79896c..f473795 100644
--- a/drivers/net/mlx5/mlx5_socket.c
+++ b/drivers/net/mlx5/mlx5_socket.c
@@ -37,7 +37,7 @@
 mlx5_pmd_socket_handle(void *cb __rte_unused)
 {
 	int conn_sock;
-	int ret = -1;
+	int ret;
 	struct cmsghdr *cmsg = NULL;
 	int data;
 	char buf[CMSG_SPACE(sizeof(int))] = { 0 };
@@ -163,7 +163,7 @@
 	struct sockaddr_un sun = {
 		.sun_family = AF_UNIX,
 	};
-	int ret = -1;
+	int ret;
 	int flags;
 
 	MLX5_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY);
-- 
1.8.3.1



More information about the dev mailing list