From patchwork Wed May 27 08:37:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 70600 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 97AB5A04A4; Wed, 27 May 2020 10:39:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9CAD01D733; Wed, 27 May 2020 10:38:53 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id C35CA1D8D3 for ; Wed, 27 May 2020 10:38:51 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE2 (envelope-from matan@mellanox.com) with ESMTPS (AES256-SHA encrypted); 27 May 2020 11:38:48 +0300 Received: from pegasus07.mtr.labs.mlnx (pegasus07.mtr.labs.mlnx [10.210.16.112]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 04R8cgsu005678; Wed, 27 May 2020 11:38:48 +0300 From: Michael Baum To: dev@dpdk.org Cc: matan@mellanox.com, viacheslavo@mellanox.com, stable@dpdk.org Date: Wed, 27 May 2020 08:37:54 +0000 Message-Id: <1590568677-11662-3-git-send-email-michaelba@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1590568677-11662-1-git-send-email-michaelba@mellanox.com> References: <1590568677-11662-1-git-send-email-michaelba@mellanox.com> Subject: [dpdk-dev] [PATCH 3/6] net/mlx5: fix unnecessary init in socket handle X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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@dpdk.org Signed-off-by: Michael Baum Acked-by: Matan Azrad --- 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);