From patchwork Wed Apr 27 08:04:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kernel test robot X-Patchwork-Id: 12828435 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93F91C433F5 for ; Wed, 27 Apr 2022 08:04:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CC5C46B0073; Wed, 27 Apr 2022 04:04:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C76166B0075; Wed, 27 Apr 2022 04:04:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B3DD96B0078; Wed, 27 Apr 2022 04:04:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id A68B06B0073 for ; Wed, 27 Apr 2022 04:04:41 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 5D28F1FDB for ; Wed, 27 Apr 2022 08:04:41 +0000 (UTC) X-FDA: 79401922362.11.A22E37A Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by imf06.hostedemail.com (Postfix) with ESMTP id 3907418004B for ; Wed, 27 Apr 2022 08:04:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651046680; x=1682582680; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=23kSWxJrZI80+FxhewCBs4Zt/CG0UV6J7Lqk+S2dTCo=; b=EAxagcLpIsJZSD4yKqRPyVSqgEHL0tkVOyC7u0ircdENNrHk76nKcVZW mlme5JhhhQezvfkgGTj+FpPadX63TeTJPbDlTmDuyAd8QNxGjMOXsnzKU BTqak1y27c9gKWYgfwkomJhvHAqUXVSb9D7YZHwrBaVCgzVe00XJMRJDZ dn86Nk4/6NmkAvSe+yLpOw5GUFeknZ0pjtvawzFFqN9M7YspSlVj3TrHZ Ts9O/oqwxso8SrOmcK6O4Fx9w3Xni4ovhLrOdpXO3oKYDdANRhkd7+7jF modytLbhCTfCEnOaN0vAoSqRnWydojGbixu2vzcLZLdv0s9tfswxwTamx g==; X-IronPort-AV: E=McAfee;i="6400,9594,10329"; a="291004754" X-IronPort-AV: E=Sophos;i="5.90,292,1643702400"; d="scan'208";a="291004754" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2022 01:04:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,292,1643702400"; d="scan'208";a="617405147" Received: from lkp-server01.sh.intel.com (HELO 5056e131ad90) ([10.239.97.150]) by fmsmga008.fm.intel.com with ESMTP; 27 Apr 2022 01:04:32 -0700 Received: from kbuild by 5056e131ad90 with local (Exim 4.95) (envelope-from ) id 1njcf2-0004Uk-76; Wed, 27 Apr 2022 08:04:32 +0000 Date: Wed, 27 Apr 2022 16:04:16 +0800 From: kernel test robot To: Andrii Nakryiko Cc: kbuild-all@lists.01.org, Linux Memory Management List , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] libbpf: fix returnvar.cocci warnings Message-ID: References: <202204271656.OTIj2QNJ-lkp@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <202204271656.OTIj2QNJ-lkp@intel.com> X-Rspamd-Queue-Id: 3907418004B X-Stat-Signature: yx86iytqaykqj3awrpouemq8zqgrp4rg X-Rspam-User: Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=EAxagcLp; spf=none (imf06.hostedemail.com: domain of lkp@intel.com has no SPF policy when checking 192.55.52.88) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspamd-Server: rspam09 X-HE-Tag: 1651046678-761245 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: kernel test robot tools/lib/bpf/relo_core.c:1064:8-11: Unneeded variable: "len". Return "0" on line 1086 Remove unneeded variable used to store return value. Generated by: scripts/coccinelle/misc/returnvar.cocci Fixes: b58af63aab11 ("libbpf: Refactor CO-RE relo human description formatting routine") CC: Andrii Nakryiko Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: f02ac5c95dfd45d2f50ecc68d79177de326c668c commit: b58af63aab11e4ae00fe96de9505759cfdde8ee9 [6746/7265] libbpf: Refactor CO-RE relo human description formatting routine :::::: branch date: 2 hours ago :::::: commit date: 9 hours ago tools/lib/bpf/relo_core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/tools/lib/bpf/relo_core.c +++ b/tools/lib/bpf/relo_core.c @@ -1061,7 +1061,7 @@ static int bpf_core_format_spec(char *bu const struct btf_enum *e; const char *s; __u32 type_id; - int i, len = 0; + int i; #define append_buf(fmt, args...) \ ({ \ @@ -1083,7 +1083,7 @@ static int bpf_core_format_spec(char *bu type_id, btf_kind_str(t), str_is_empty(s) ? "" : s); if (core_relo_is_type_based(spec->relo_kind)) - return len; + return 0; if (core_relo_is_enumval_based(spec->relo_kind)) { t = skip_mods_and_typedefs(spec->btf, type_id, NULL); @@ -1091,7 +1091,7 @@ static int bpf_core_format_spec(char *bu s = btf__name_by_offset(spec->btf, e->name_off); append_buf("::%s = %u", s, e->val); - return len; + return 0; } if (core_relo_is_field_based(spec->relo_kind)) { @@ -1110,10 +1110,10 @@ static int bpf_core_format_spec(char *bu append_buf(" @ offset %u.%u)", spec->bit_offset / 8, spec->bit_offset % 8); else append_buf(" @ offset %u)", spec->bit_offset / 8); - return len; + return 0; } - return len; + return 0; #undef append_buf }