Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1321336rdb; Wed, 24 Jan 2024 11:15:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IHA6bBJ67A94dQplEUuyQCYHosIkDHCblxcS2FVGG5TZZfVhn6GGGB7pDcBLciESccJBDaP X-Received: by 2002:a17:90a:2dc1:b0:290:6dfc:a7e5 with SMTP id q1-20020a17090a2dc100b002906dfca7e5mr26227pjm.17.1706123729281; Wed, 24 Jan 2024 11:15:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706123729; cv=pass; d=google.com; s=arc-20160816; b=zpCTh/0t7iE6Kv9LJYKxhAa8xc9YHCxIYbJvTWzlLSNB9Ra7ZM9S4+m06xq1pG/h3r ESZrk1liBVMqu3SsG+ffCt/ZE7zs7d+jRvnacOVrl7y99EbRjtl66y0Nz01XPf8xJdxU DN88H2OuhPGYtZyheZkiN/n0TMtXBmXLPtdj53eHjt70OYSjccEE+CAQYW6bCYnYk8uY i29LnrYeJFQsVo6lAZv8aF4R+Xgj1PFcXgEx5heEJyYczT6y74lQiPEzDXEhCBRpn52u fpnVxqEBUMs6UCRpDSGzM+jSDrFHb2yep2rtldICUsDDqF2hNtX6Fr2Av8XJ8Q5fFndV k0ag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2krLzEMQIQ+tFkjdyDir4TC8HQgYTlc8+l+XGa7jNp0=; fh=likCc42lMVVmZwPQsf4mGahM9ktEpY6aj7Sd/fh7B+Q=; b=OxgkTjHPqlChVKDZXjeA7rld5y6pLWnGzbHM5/gXHKzivmtNEcCbdtEwtjvau55t8r wCPLn3iDCiLo2fcdefShsEXKgcVRu/UYWudYq2jqSGY9ocDFGAb6GaQQA0LuJ1s5dpsS lsNa35cmz5ZHhjdT0Kid94qAmjv0VxsaY8yhqWZGVa3X1RC17fmOfkIblKWU/7tZByc2 3i1fqDKRp1iOYxnJDEAD5a1TuzpL2ZLZnPL9bVP9Q/ynnsJBLYmeQOX2S+1maz+Rp9Si eJwl33bOxbNX1+p1oVcPr26riK+/tNTQD3E7N5HaJTLtvEPb++ni1OSJWlkNPC8MDF6x x4uA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=a1KcDgtJ; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-37582-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37582-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id by6-20020a056a00400600b006db8855e8b6si2878304pfb.187.2024.01.24.11.15.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 11:15:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37582-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=a1KcDgtJ; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-37582-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37582-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DEEA42847A4 for ; Wed, 24 Jan 2024 19:15:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5CC12131E4E; Wed, 24 Jan 2024 19:15:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b="a1KcDgtJ" Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) (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 7A6BF77F36; Wed, 24 Jan 2024 19:15:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=65.109.113.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706123720; cv=none; b=qFwbHruDHpmU1lEJpl3nBXnBS8zw2p2AkOA7d3EU5cCzvRWvfnlKASOjf3J05pOksTYU9Y9AHUnm+ZCpYZ/QkP1yk71r8I7GdvaTWFWM3u4TI1EEx7j3t/q/cnxLFLpGttx2Kx6Zbd9NFCh18VRAeMj4M/nk3H1rbmxAMIa7KbA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706123720; c=relaxed/simple; bh=VcHlyJIXlxH3aERAxZ/QM+6SquAmwdoVRQMgH+M+Ow4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EdvWL5Wxv07H3fiY30Zx261G7lWVeXjdK/BZBo1mbN34LPype4aI2YjZ5NZQgZUffywa1Qr6GfWUvKy49ZZlRpSztw4j3Ho7BvP/FXmlnkk9iIrrt9X3LGL6vY4uX/1bB2AOUFr68rq0j7z+trefxSm6w/b1WrrG/JNrCs8c/ms= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de; spf=pass smtp.mailfrom=alien8.de; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b=a1KcDgtJ; arc=none smtp.client-ip=65.109.113.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alien8.de Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id 6DE7C40E01A9; Wed, 24 Jan 2024 19:15:14 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Authentication-Results: mail.alien8.de (amavisd-new); dkim=pass (4096-bit key) header.d=alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Q8rzXvTGYIO5; Wed, 24 Jan 2024 19:15:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1706123711; bh=2krLzEMQIQ+tFkjdyDir4TC8HQgYTlc8+l+XGa7jNp0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=a1KcDgtJDEo2ovI49n8md2R/fKXHf09N0P/AWKrEpVFzp3oZzfzQD5+rZPuaPdqju LtI2YkBwx4DtZ2FDC3gg/1Rot4+lHTlH3yzQfpVm6plm6KfbhTXCLhDdWngAMoInzc NvcEb2G3sx49+72RjdaBPsa+phyNdlFW6mfRRqwpf0aEAC2OaqnMwGMI7SF4cgLwzd 8mivnFvGsYm3kI5DyM5RBeL/Oy+bGfwhS/94Zxj1nwvkk82Z+j5x16nZvAYXZmMBXa gmGz674ObX+9e6eUbe0ga7RrX0/bPh9Uy+mxbqiiQvTGwky0GD69ygSbDDSATyyLWR fGIzOgsZkqG8TY9rsLBd9boK5ZozTqG/7H+yfyqy8mBmSbbdflXeLSa5Dpg6Km3vdi Ssx240vV9yrnczi2f+jgFt0KO12jk6a8sIz0+FxnC/9XlxH+F+zF2yC1u48yhgA0TZ yZ0ILGhTrQMvtAhu6kxNWxSwcF32l8GCzy+hVPBJwZt4cCZ/SKymbQo9fsgz4qYmtZ mXI+byFxGGZzV7qtrDtw4sEMW2p7DmVkv94t8SLxsizHWU71vPpF2jhBj5Necrc3SA jUW0Op06airRtlY16D/vwqwNgbsiGrcAZd2BYBw/D2K3+DuQkS+eIbI5VJRE14U18Z WzjEKLu+DggB4qP30LEpAHQQ= Received: from zn.tnic (pd953033e.dip0.t-ipconnect.de [217.83.3.62]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id EFBD840E0177; Wed, 24 Jan 2024 19:14:36 +0000 (UTC) Date: Wed, 24 Jan 2024 20:14:29 +0100 From: Borislav Petkov To: Reinette Chatre Cc: Babu Moger , corbet@lwn.net, fenghua.yu@intel.com, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, paulmck@kernel.org, rdunlap@infradead.org, tj@kernel.org, peterz@infradead.org, yanjiewtw@gmail.com, kim.phillips@amd.com, lukas.bulwahn@gmail.com, seanjc@google.com, jmattson@google.com, leitao@debian.org, jpoimboe@kernel.org, rick.p.edgecombe@intel.com, kirill.shutemov@linux.intel.com, jithu.joseph@intel.com, kai.huang@intel.com, kan.liang@linux.intel.com, daniel.sneddon@linux.intel.com, pbonzini@redhat.com, sandipan.das@amd.com, ilpo.jarvinen@linux.intel.com, peternewman@google.com, maciej.wieczor-retman@intel.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, eranian@google.com Subject: Re: [PATCH] x86/resctrl: Fix unneeded variable warning reported by kernel test robot Message-ID: <20240124191429.GGZbFhldYr3K85H9cg@fat_crate.local> References: <202401241810.jbd8Ipa1-lkp@intel.com> <84128a3c83654493f637b8349153af10d69e2752.1706118776.git.babu.moger@amd.com> <39c4501e-4937-49de-b12b-742e6201df6f@intel.com> <20240124183153.GFZbFXmTKTLEpwZshW@fat_crate.local> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Wed, Jan 24, 2024 at 10:51:49AM -0800, Reinette Chatre wrote: > Thank you very much. For what it is worth, I do agree with the actual fix > and you can add: > Acked-by: Reinette Chatre Ok, have a look at the below, pls, and lemme know if that's ok too. mbm_config_write_domain() only returns 0 so it can be void. So the callsite doesn't need to check retval either. Thx. --- From: Babu Moger Date: Wed, 24 Jan 2024 11:52:56 -0600 Subject: [PATCH] x86/resctrl: Remove redundant variable in mbm_config_write_domain() The kernel test robot reported the following warning after 54e35eb8611c ("x86/resctrl: Read supported bandwidth sources from CPUID"). even though the issue is present even in the original patch which added this function 92bd5a139033 ("x86/resctrl: Add interface to write mbm_total_bytes_config") $ make C=1 CHECK=scripts/coccicheck arch/x86/kernel/cpu/resctrl/rdtgroup.o ... arch/x86/kernel/cpu/resctrl/rdtgroup.c:1621:5-8: Unneeded variable: "ret". Return "0" on line 1655 Remove the local variable 'ret'. [ bp: Massage commit message, make mbm_config_write_domain() void. ] Fixes: 92bd5a139033 ("x86/resctrl: Add interface to write mbm_total_bytes_config") Closes: https://lore.kernel.org/oe-kbuild-all/202401241810.jbd8Ipa1-lkp@intel.com/ Reported-by: kernel test robot Signed-off-by: Babu Moger Signed-off-by: Borislav Petkov (AMD) Acked-by: Reinette Chatre Link: https://lore.kernel.org/r/202401241810.jbd8Ipa1-lkp@intel.com --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 2b69e560b05f..c33eb77b6d70 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1614,11 +1614,10 @@ static void mon_event_config_write(void *info) wrmsr(MSR_IA32_EVT_CFG_BASE + index, mon_info->mon_config, 0); } -static int mbm_config_write_domain(struct rdt_resource *r, +static void mbm_config_write_domain(struct rdt_resource *r, struct rdt_domain *d, u32 evtid, u32 val) { struct mon_config_info mon_info = {0}; - int ret = 0; /* * Read the current config value first. If both are the same then @@ -1627,7 +1626,7 @@ static int mbm_config_write_domain(struct rdt_resource *r, mon_info.evtid = evtid; mondata_config_read(d, &mon_info); if (mon_info.mon_config == val) - goto out; + return; mon_info.mon_config = val; @@ -1650,9 +1649,6 @@ static int mbm_config_write_domain(struct rdt_resource *r, * mbm_local and mbm_total counts for all the RMIDs. */ resctrl_arch_reset_rmid_all(r, d); - -out: - return ret; } static int mon_config_write(struct rdt_resource *r, char *tok, u32 evtid) @@ -1661,7 +1657,6 @@ static int mon_config_write(struct rdt_resource *r, char *tok, u32 evtid) char *dom_str = NULL, *id_str; unsigned long dom_id, val; struct rdt_domain *d; - int ret = 0; next: if (!tok || tok[0] == '\0') @@ -1690,9 +1685,7 @@ static int mon_config_write(struct rdt_resource *r, char *tok, u32 evtid) list_for_each_entry(d, &r->domains, list) { if (d->id == dom_id) { - ret = mbm_config_write_domain(r, d, evtid, val); - if (ret) - return -EINVAL; + mbm_config_write_domain(r, d, evtid, val); goto next; } } -- 2.43.0 -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette