From patchwork Fri Aug 4 17:59:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li kunyu X-Patchwork-Id: 130239 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp847697vqx; Wed, 2 Aug 2023 18:50:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlFYXwJENlm8JjlRbXwM+1VrFImxFu1ARnCxWZWU5V4+6oN58gv6JW1SOUpx8qmV4ieabq+v X-Received: by 2002:adf:f646:0:b0:317:6c66:bdc3 with SMTP id x6-20020adff646000000b003176c66bdc3mr10549408wrp.7.1691027423496; Wed, 02 Aug 2023 18:50:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691027423; cv=none; d=google.com; s=arc-20160816; b=iyVWcY8nCU0nWkDwEqxOFejOBImw3iS/AnGwI+mDrjkf8aD9f06Y92jQk2ExvsoXu8 Xmew/abzbr2YsAXVl66EIWOivTZS9hypxH1XqkTVKr3BCfE1WYbQ6EwZCT7p+5UdoIVe QM9eEDQRYwJwKp+tA0eLPBCmTuv1SAaz2oChePyWCyG73Povt0zRyI0hHYmYkF/GckqM /4Jg5dp5frNaxt9SDIVeNmWLJhKUw+5J28ySrcWsjDnqSeeM3xRw0GBv2eNAcevMezxP m8THKZjtUMpESW6N0qKqErLZ/7Ym3OT/JJkC55S18xZ5VhfydiVumQ3JzhI2zOCZmIBj f4Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=cUwMJEadu41FAxX4aKAp+VvIYZpbhT2jkzP6ZGxKBy8=; fh=Wa0H2M3yk6Gz1MsQhqMDKtl0kfkJtCM7R04a9vkfNz0=; b=n8nui4k+xF/8QWM/q5C5X3KsGAgC8bZoF3WjcgKtWHp8LfcJ43QWRqt86BLD/lCNB7 APu8QJPjmU+xPpyUmXZcHa1gsi+7skvo32AazcO1vKiunVoQ0CTxADJUowt8Qc/4DaB4 iYzRhkM2hBHhtmqpGcVRn0MKta/qDi8Xx64GJFl9tO+JhRVod+TgF2W0GSC/JpVnkjt3 yKX2I1hVGExzFxHBvBdMTNzYy1zdIyvc7WWNgJi7DhzdyiiFYtPAIzWYxaP0+EFPMOc2 NcIuklcIfL/tcgtOPs2KeVBRm5qYq6fEKXhIT/rThEmBBWoCTu2aRpa9/mtlUcQXU4ij Z1dA== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ot17-20020a170906ccd100b00997eac101cesi10818614ejb.843.2023.08.02.18.50.00; Wed, 02 Aug 2023 18:50:23 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231542AbjHCB2U (ORCPT + 99 others); Wed, 2 Aug 2023 21:28:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbjHCB2S (ORCPT ); Wed, 2 Aug 2023 21:28:18 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 3647C26BA; Wed, 2 Aug 2023 18:28:17 -0700 (PDT) Received: from localhost.localdomain (unknown [219.141.250.2]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id 3EEF1602E666B; Thu, 3 Aug 2023 09:28:14 +0800 (CST) X-MD-Sfrom: kunyu@nfschina.com X-MD-SrcIP: 219.141.250.2 From: Li kunyu To: martin.lau@linux.dev, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Li kunyu Subject: [PATCH bpf-next v2] bpf: bpf_struct_ops: Remove unnecessary initial values of variables Date: Sat, 5 Aug 2023 01:59:29 +0800 Message-Id: <20230804175929.2867-1-kunyu@nfschina.com> X-Mailer: git-send-email 2.18.2 X-Spam-Status: No, score=0.9 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_24_48, RDNS_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773170771712426203 X-GMAIL-MSGID: 1773170771712426203 err and tlinks is assigned first, so it does not need to initialize the assignment. Signed-off-by: Li kunyu Reviewed-by: Simon Horman --- v2: Remove tlinks initialization assignment. kernel/bpf/bpf_struct_ops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c index d3f0a4825fa6..c05585ed1f37 100644 --- a/kernel/bpf/bpf_struct_ops.c +++ b/kernel/bpf/bpf_struct_ops.c @@ -374,9 +374,9 @@ static long bpf_struct_ops_map_update_elem(struct bpf_map *map, void *key, struct bpf_struct_ops_value *uvalue, *kvalue; const struct btf_member *member; const struct btf_type *t = st_ops->type; - struct bpf_tramp_links *tlinks = NULL; + struct bpf_tramp_links *tlinks; void *udata, *kdata; - int prog_fd, err = 0; + int prog_fd, err; void *image, *image_end; u32 i; @@ -818,7 +818,7 @@ static int bpf_struct_ops_map_link_update(struct bpf_link *link, struct bpf_map struct bpf_struct_ops_map *st_map, *old_st_map; struct bpf_map *old_map; struct bpf_struct_ops_link *st_link; - int err = 0; + int err; st_link = container_of(link, struct bpf_struct_ops_link, link); st_map = container_of(new_map, struct bpf_struct_ops_map, map);