Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2061329rwe; Sun, 28 Aug 2022 02:59:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR4ZYnfGZ954naU6tCBEcjFzkrnOAftPAixB13hwq17J3SkGygQwv5G3dYaK2TiK5Izd5PCM X-Received: by 2002:a17:90b:2685:b0:1fa:b21d:34ce with SMTP id pl5-20020a17090b268500b001fab21d34cemr13040524pjb.188.1661680750883; Sun, 28 Aug 2022 02:59:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661680750; cv=none; d=google.com; s=arc-20160816; b=08wqxr8uZIJfq8OBVBDS6kMz/bpZXQjgO9GqUDMy0Slmyl3llXHaO+UDUc5SBZPU1+ SqGwoXV+9OZLCY/cqgJCLtSsdf54RzSLt69IQHkkG03tQvRtNyvYJv3O4ADyVpOG/DG6 26wF2j3YQ1EhqbjDX0g9hQpkuOZCkCXhHq7eFcsBZYMZGUCaUlZ1AGoWyTsO7Mpsrw1H xozQ1e8+PsTUgQO1Ql+I9f4dfkW9UL1kXysCV6QdIk6YNCP0vs4u0Ms3gdUI2El87jE5 rO+Itg+4mcyGMZjyDnoDyMKmhPRgqRl6Wf1njXEolNWzvME0BudqF8Bk+bmCTc2OA59z PBPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=F3JR8kW/LYyiFA4D6FGGgxMk6uKhwL+5wfi/f3t4BoA=; b=btv3byv2Fz/g1iGRgConqC65a9V65VgcKpto2bvZG+u60VV1JtnXe1j2/p4oISFcTk +XtU/GMylqFBRNk7vl9rc06vySwPAoj2jKb72KCVQ78AtCtzUnZmtAj5pmvVHR6o5VFT u9nq4uE5wuPte7wFWTdU56AKkadntT/rhYUHr/PJ3SENHSe+BhILS6INLURBOBn7/DQk pjF/LNcZ2rx894t8Q0TWCnIYLI1po3ARYSVgtH+yRZ2qApvtxCzA+5Vp05xYKsNH4g9n oy/sQ+bHzs7hsvOB4MJbLPDuJbhQmcz4DhC3S+iukaahTdM5eKr3V2WSd8bN/Q4lJqTB p5/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rxq1frQ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 12-20020a17090a034c00b001fb158c56d8si6448965pjf.113.2022.08.28.02.59.00; Sun, 28 Aug 2022 02:59:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rxq1frQ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229511AbiH1Jzv (ORCPT + 99 others); Sun, 28 Aug 2022 05:55:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbiH1Jzt (ORCPT ); Sun, 28 Aug 2022 05:55:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9613C43E5D; Sun, 28 Aug 2022 02:55:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4A1EDB80A3A; Sun, 28 Aug 2022 09:55:47 +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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220825180607.2707947-1-nathan@kernel.org> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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