From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FAC723CD; Sun, 28 Aug 2022 09:55:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A978C433C1; Sun, 28 Aug 2022 09:55:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661680546; bh=TcwxDWZtQS6kMjN2jg9yz87Lt7T5qZ8ftJVQLc8rmrI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Rxq1frQ4Y7jG/7PA4ZNlJ7bYY/4+1Ihaz96hMvhmyswpnbYQ9NfPX9HShQ2ybT6pW It1NQhz+dlZPJe19lcZ+FwtAT1QC0wS7J1y0qZMHoD7pMwPnwLHGMNDo4YxxCJxpdg nDMHMiQE91NuwChoGUW2JC84wJEQOE5uSBM8uP79WzpX9vAq5FH5bhXnTFAkrLlLjx v3OlNw401ZIXH6LvhActC8mcqhOjRwjzPO+wygYnRinPMZaebAgt7yWX4EZAMZiQcM Lgz0AKaIZMWaXfsiePeR9j5QbrhaGtdZhnfw6+8k071rcdP/AOYfBpyBuuee1BNVGS bQmnUOm6KjyYg== Date: Sun, 28 Aug 2022 12:55:41 +0300 From: Leon Romanovsky To: Nathan Chancellor Cc: Saeed Mahameed , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Nick Desaulniers , Tom Rix , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev Subject: Re: [PATCH net-next] net/mlx5e: Do not use err uninitialized in mlx5e_rep_add_meta_tunnel_rule() Message-ID: References: <20220825180607.2707947-1-nathan@kernel.org> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220825180607.2707947-1-nathan@kernel.org> On Thu, Aug 25, 2022 at 11:06:07AM -0700, Nathan Chancellor wrote: > Clang warns: > > drivers/net/ethernet/mellanox/mlx5/core/en_rep.c:481:6: error: variable 'err' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] > if (IS_ERR(flow_rule)) { > ^~~~~~~~~~~~~~~~~ > drivers/net/ethernet/mellanox/mlx5/core/en_rep.c:489:9: note: uninitialized use occurs here > return err; > ^~~ > drivers/net/ethernet/mellanox/mlx5/core/en_rep.c:481:2: note: remove the 'if' if its condition is always true > if (IS_ERR(flow_rule)) { > ^~~~~~~~~~~~~~~~~~~~~~~ > drivers/net/ethernet/mellanox/mlx5/core/en_rep.c:474:9: note: initialize the variable 'err' to silence this warning > int err; > ^ > = 0 > 1 error generated. > > There is little reason to have the 'goto + error variable' construct in > this function. Get rid of it and just return the PTR_ERR value in the if > statement and 0 at the end. > > Fixes: 430e2d5e2a98 ("net/mlx5: E-Switch, Move send to vport meta rule creation") > Link: https://github.com/ClangBuiltLinux/linux/issues/1695 > Signed-off-by: Nathan Chancellor > --- > drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > Thanks, Reviewed-by: Leon Romanovsky