Message ID | 20230813014734.2916-1-kunyu@nfschina.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp979133vqi; Fri, 11 Aug 2023 03:10:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFssyO2dfJKsJ90dnTX9o6Z2MNFK7WnkRwLfsJwvvwr9CcmiVq/om/TTo9DCc4mSOW12T1j X-Received: by 2002:aa7:c2d3:0:b0:523:4996:a4f9 with SMTP id m19-20020aa7c2d3000000b005234996a4f9mr1286368edp.34.1691748624294; Fri, 11 Aug 2023 03:10:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691748624; cv=none; d=google.com; s=arc-20160816; b=fkyq5JYsxxgqL2owsGNn+ijEb5GcJ6/fKe2ye4XUrY+ACY0k1Q28J1JhtmR0u+UrcQ SAbOsl71D/+tY0joDEC8H703saagWqms9vbErkocz2cUOV1qIRshfA1dZmFIpgy1o4mI 5wJI+NNrU1kfiehL8LxY9PYnuv1YJNMEWeNnZI4z7S1VGF4MzI2I2JouTyttxkkqWKUp iSVltRCZZRdOaf2+TuUmDrKigGZXneS1C7eweuwOZR024IUmImmHSzWfYtL8xPN8qMTw P1gPse1Zl2QeLTBFrhMpmx1cDc8LMEW2bOvYaO/8sl/JUtVDKIKpTxgL9ZQfmqDAc5dR srjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=PuMsgiwQadyMTlLrgCyFavGQOnrfKi0fvuGypev1X0k=; fh=3vtYlIUzX5mvgfEsHX1c04bXxEfZZPfgCfm1sZQSCmc=; b=aZXNra9g8N04nYfs5XWW8zX6nRNM80QDlql2JnaY9bpGw7H4hLhwRnaVfJ2OzJ74hx 3W4nuZwoDu2oCE+4HsbUGqxQoZKQpiTezvVq5dS/D2PRb9d9HvlUL7TLv5pNTUPpcS9u ttg/ONFAc8/tKoF2Ki4CRgZbt4ECGuyNl/ERV3grTuSbuimjpHzSFmQk1cniBxnMyA7+ k/UxFk3J8DMHho+7wvSKMNHxm4z8VoSMjha/80/bDtGvbsyqiWTCXAltSbJwXU5tbQQY qlmUJJ9nMPQvy4ThgZ7ca1GxFPAYv3xj/kR14ml0CUQ51/YeA6hYpISH64QdTxksWvfg 0J0Q== 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 h11-20020aa7de0b000000b005223c32fd2asi3047774edv.570.2023.08.11.03.10.00; Fri, 11 Aug 2023 03:10:24 -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 S234852AbjHKJQc (ORCPT <rfc822;shaohuahua6@gmail.com> + 99 others); Fri, 11 Aug 2023 05:16:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234802AbjHKJQ0 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 11 Aug 2023 05:16:26 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id EFDEB2D5B; Fri, 11 Aug 2023 02:16:24 -0700 (PDT) Received: from localhost.localdomain (unknown [219.141.250.2]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id 46D96605E83D9; Fri, 11 Aug 2023 17:16:15 +0800 (CST) X-MD-Sfrom: kunyu@nfschina.com X-MD-SrcIP: 219.141.250.2 From: Li kunyu <kunyu@nfschina.com> To: tj@kernel.org, lizefan.x@bytedance.com, hannes@cmpxchg.org Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Li kunyu <kunyu@nfschina.com> Subject: [PATCH] =?utf-8?q?cgroup=3A_cgroup=3A_Remove_unnecessary_=E2=80=980?= =?utf-8?q?=E2=80=99_values_from_ret?= Date: Sun, 13 Aug 2023 09:47:34 +0800 Message-Id: <20230813014734.2916-1-kunyu@nfschina.com> X-Mailer: git-send-email 2.18.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773927005293497829 X-GMAIL-MSGID: 1773927005293497829 |
Series |
cgroup: cgroup: Remove unnecessary ‘0’ values from ret
|
|
Commit Message
Li kunyu
Aug. 13, 2023, 1:47 a.m. UTC
ret is assigned first, so it does not need to initialize the assignment.
Signed-off-by: Li kunyu <kunyu@nfschina.com>
---
kernel/cgroup/cgroup.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
Comments
Hi Li,
kernel test robot noticed the following build warnings:
[auto build test WARNING on v6.5-rc5]
[also build test WARNING on linus/master next-20230809]
[cannot apply to tj-cgroup/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Li-kunyu/cgroup-cgroup-Remove-unnecessary-0-values-from-ret/20230811-171814
base: v6.5-rc5
patch link: https://lore.kernel.org/r/20230813014734.2916-1-kunyu%40nfschina.com
patch subject: [PATCH] cgroup: cgroup: Remove unnecessary ‘0’ values from ret
config: nios2-randconfig-r031-20230811 (https://download.01.org/0day-ci/archive/20230811/202308112134.cHq2KhFM-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230811/202308112134.cHq2KhFM-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308112134.cHq2KhFM-lkp@intel.com/
All warnings (new ones prefixed by >>):
kernel/cgroup/cgroup.c: In function 'delegate_show':
>> kernel/cgroup/cgroup.c:7000:15: warning: 'ret' is used uninitialized [-Wuninitialized]
7000 | ret = show_delegatable_files(cgroup_base_files, buf + ret,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7001 | PAGE_SIZE - ret, NULL);
| ~~~~~~~~~~~~~~~~~~~~~~
kernel/cgroup/cgroup.c:6998:17: note: 'ret' was declared here
6998 | ssize_t ret;
| ^~~
vim +/ret +7000 kernel/cgroup/cgroup.c
01ee6cfb1483fe Roman Gushchin 2017-11-06 6992
01ee6cfb1483fe Roman Gushchin 2017-11-06 6993 static ssize_t delegate_show(struct kobject *kobj, struct kobj_attribute *attr,
01ee6cfb1483fe Roman Gushchin 2017-11-06 6994 char *buf)
01ee6cfb1483fe Roman Gushchin 2017-11-06 6995 {
01ee6cfb1483fe Roman Gushchin 2017-11-06 6996 struct cgroup_subsys *ss;
01ee6cfb1483fe Roman Gushchin 2017-11-06 6997 int ssid;
3d7f13682faf54 Li kunyu 2023-08-13 6998 ssize_t ret;
01ee6cfb1483fe Roman Gushchin 2017-11-06 6999
8a693f7766f9e2 Tejun Heo 2022-09-06 @7000 ret = show_delegatable_files(cgroup_base_files, buf + ret,
8a693f7766f9e2 Tejun Heo 2022-09-06 7001 PAGE_SIZE - ret, NULL);
8a693f7766f9e2 Tejun Heo 2022-09-06 7002 if (cgroup_psi_enabled())
8a693f7766f9e2 Tejun Heo 2022-09-06 7003 ret += show_delegatable_files(cgroup_psi_files, buf + ret,
8a693f7766f9e2 Tejun Heo 2022-09-06 7004 PAGE_SIZE - ret, NULL);
01ee6cfb1483fe Roman Gushchin 2017-11-06 7005
01ee6cfb1483fe Roman Gushchin 2017-11-06 7006 for_each_subsys(ss, ssid)
01ee6cfb1483fe Roman Gushchin 2017-11-06 7007 ret += show_delegatable_files(ss->dfl_cftypes, buf + ret,
01ee6cfb1483fe Roman Gushchin 2017-11-06 7008 PAGE_SIZE - ret,
01ee6cfb1483fe Roman Gushchin 2017-11-06 7009 cgroup_subsys_name[ssid]);
01ee6cfb1483fe Roman Gushchin 2017-11-06 7010
01ee6cfb1483fe Roman Gushchin 2017-11-06 7011 return ret;
01ee6cfb1483fe Roman Gushchin 2017-11-06 7012 }
01ee6cfb1483fe Roman Gushchin 2017-11-06 7013 static struct kobj_attribute cgroup_delegate_attr = __ATTR_RO(delegate);
01ee6cfb1483fe Roman Gushchin 2017-11-06 7014
Hi Li,
kernel test robot noticed the following build warnings:
[auto build test WARNING on v6.5-rc5]
[also build test WARNING on linus/master next-20230809]
[cannot apply to tj-cgroup/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Li-kunyu/cgroup-cgroup-Remove-unnecessary-0-values-from-ret/20230811-171814
base: v6.5-rc5
patch link: https://lore.kernel.org/r/20230813014734.2916-1-kunyu%40nfschina.com
patch subject: [PATCH] cgroup: cgroup: Remove unnecessary ‘0’ values from ret
config: x86_64-randconfig-r035-20230811 (https://download.01.org/0day-ci/archive/20230811/202308112139.lVjuXYZg-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce: (https://download.01.org/0day-ci/archive/20230811/202308112139.lVjuXYZg-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308112139.lVjuXYZg-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> kernel/cgroup/cgroup.c:7000:56: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
ret = show_delegatable_files(cgroup_base_files, buf + ret,
^~~
kernel/cgroup/cgroup.c:6998:13: note: initialize the variable 'ret' to silence this warning
ssize_t ret;
^
= 0
1 warning generated.
vim +/ret +7000 kernel/cgroup/cgroup.c
01ee6cfb1483fe Roman Gushchin 2017-11-06 6992
01ee6cfb1483fe Roman Gushchin 2017-11-06 6993 static ssize_t delegate_show(struct kobject *kobj, struct kobj_attribute *attr,
01ee6cfb1483fe Roman Gushchin 2017-11-06 6994 char *buf)
01ee6cfb1483fe Roman Gushchin 2017-11-06 6995 {
01ee6cfb1483fe Roman Gushchin 2017-11-06 6996 struct cgroup_subsys *ss;
01ee6cfb1483fe Roman Gushchin 2017-11-06 6997 int ssid;
3d7f13682faf54 Li kunyu 2023-08-13 6998 ssize_t ret;
01ee6cfb1483fe Roman Gushchin 2017-11-06 6999
8a693f7766f9e2 Tejun Heo 2022-09-06 @7000 ret = show_delegatable_files(cgroup_base_files, buf + ret,
8a693f7766f9e2 Tejun Heo 2022-09-06 7001 PAGE_SIZE - ret, NULL);
8a693f7766f9e2 Tejun Heo 2022-09-06 7002 if (cgroup_psi_enabled())
8a693f7766f9e2 Tejun Heo 2022-09-06 7003 ret += show_delegatable_files(cgroup_psi_files, buf + ret,
8a693f7766f9e2 Tejun Heo 2022-09-06 7004 PAGE_SIZE - ret, NULL);
01ee6cfb1483fe Roman Gushchin 2017-11-06 7005
01ee6cfb1483fe Roman Gushchin 2017-11-06 7006 for_each_subsys(ss, ssid)
01ee6cfb1483fe Roman Gushchin 2017-11-06 7007 ret += show_delegatable_files(ss->dfl_cftypes, buf + ret,
01ee6cfb1483fe Roman Gushchin 2017-11-06 7008 PAGE_SIZE - ret,
01ee6cfb1483fe Roman Gushchin 2017-11-06 7009 cgroup_subsys_name[ssid]);
01ee6cfb1483fe Roman Gushchin 2017-11-06 7010
01ee6cfb1483fe Roman Gushchin 2017-11-06 7011 return ret;
01ee6cfb1483fe Roman Gushchin 2017-11-06 7012 }
01ee6cfb1483fe Roman Gushchin 2017-11-06 7013 static struct kobj_attribute cgroup_delegate_attr = __ATTR_RO(delegate);
01ee6cfb1483fe Roman Gushchin 2017-11-06 7014
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index f55a40db065f..cdda2a147d6b 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -2859,7 +2859,7 @@ int cgroup_attach_task(struct cgroup *dst_cgrp, struct task_struct *leader, { DEFINE_CGROUP_MGCTX(mgctx); struct task_struct *task; - int ret = 0; + int ret; /* look up all src csets */ spin_lock_irq(&css_set_lock); @@ -3945,7 +3945,7 @@ static void cgroup_kill(struct cgroup *cgrp) static ssize_t cgroup_kill_write(struct kernfs_open_file *of, char *buf, size_t nbytes, loff_t off) { - ssize_t ret = 0; + ssize_t ret; int kill; struct cgroup *cgrp; @@ -5083,7 +5083,7 @@ static int cgroup_attach_permissions(struct cgroup *src_cgrp, struct super_block *sb, bool threadgroup, struct cgroup_namespace *ns) { - int ret = 0; + int ret; ret = cgroup_procs_write_permission(src_cgrp, dst_cgrp, sb, ns); if (ret) @@ -5921,7 +5921,7 @@ static int cgroup_destroy_locked(struct cgroup *cgrp) int cgroup_rmdir(struct kernfs_node *kn) { struct cgroup *cgrp; - int ret = 0; + int ret; cgrp = cgroup_kn_lock_live(kn, false); if (!cgrp) @@ -6995,7 +6995,7 @@ static ssize_t delegate_show(struct kobject *kobj, struct kobj_attribute *attr, { struct cgroup_subsys *ss; int ssid; - ssize_t ret = 0; + ssize_t ret; ret = show_delegatable_files(cgroup_base_files, buf + ret, PAGE_SIZE - ret, NULL);