Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3316035rwb; Mon, 19 Sep 2022 19:37:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4jvoySpEjfcx5fP/DYALRMZNyvvA7ABoPSQsFs7fewt3NHIpA8gDJ1sG6XHNLStqZ+K0u3 X-Received: by 2002:a05:6402:1f06:b0:447:f6a0:2f71 with SMTP id b6-20020a0564021f0600b00447f6a02f71mr17832970edb.243.1663641476154; Mon, 19 Sep 2022 19:37:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663641476; cv=none; d=google.com; s=arc-20160816; b=Wgh4V0nHQSGB2wxfyweUbfJVSBGjhCCCX5HhC/jQL5QBaylBX9OIuM2Qg6JUvkQyCE zci7r6SwVNWopyHaTGJvMEI+F4I5ft6Z7aISuJLtSEIco4JPkXeTV7EmCn6wmCaqOYsi ZM9i3Iz4TDRmJKUky2011t3cnYIg93kuOBySpY8GHGvk3sc9dyZ8Qfv1F0trp5YxuUHV YFmA5VjlfHPWQ5rMLm5DfUI1dw94FHCFvhrxZ8nJvCIUFjqi9tORbQdJY8VDKZKnJ3P6 mRSNGKv6wSkdgiPwQoEkuBToct+Uty2U+93TvRKf5dR+povUmzcjrDhqqACc2OpAmBwt uWjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=X0r/TzeavhfS5LNdTEGxDiLypZGp8G4lWN2M9qarp5w=; b=kmcJ1k7XzM0w+AEX+sqVGH2XyXD4Yf31pbH6GHefG9BMy4KeAQCoi3gld7YupECPk9 ipOzKcTD7a4TGOlqBLfuRI14ADpqSM1e3ufCkedOufrL8I+NN+2KunlqIS7kvUIHN5Vt pjsDGUsDQFYzbuHa9+A+DnHJ51yUZtPKKEEx1eNVAFXZTJpYiO5pQ6bfstHmL8U20u8H xOPAbk7fVeyCOQt5B3wZJZjf3vsufkTrlqYBZJ5ebWBBMni+Au4UdZO2EExZARiDpSor 3LpEDxPlTsWIAFJtX+ziBbvzqM3bVzDISKybFN/OFTH2q5YsTKD/YGoprwoRyNRkx0YS Nh7A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc28-20020a1709078a1c00b0077f92be81aasi118169ejc.379.2022.09.19.19.37.28; Mon, 19 Sep 2022 19:37:56 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230037AbiITBye (ORCPT + 99 others); Mon, 19 Sep 2022 21:54:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229689AbiITByb (ORCPT ); Mon, 19 Sep 2022 21:54:31 -0400 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD1692FC for ; Mon, 19 Sep 2022 18:54:27 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R831e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=xhao@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VQGZuw6_1663638864; Received: from 30.240.98.170(mailfrom:xhao@linux.alibaba.com fp:SMTPD_---0VQGZuw6_1663638864) by smtp.aliyun-inc.com; Tue, 20 Sep 2022 09:54:25 +0800 Message-ID: Date: Tue, 20 Sep 2022 09:54:23 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH v1 1/2] mm/damon/sysfs: remove unnecessary variables To: SeongJae Park Cc: akpm@linux-foundation.org, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20220919170305.61335-1-sj@kernel.org> From: haoxin In-Reply-To: <20220919170305.61335-1-sj@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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 在 2022/9/20 上午1:03, SeongJae Park 写道: > On Mon, 19 Sep 2022 23:12:00 +0800 Xin Hao wrote: > >> Just do a little change here, the 'err' variable really no need to stay >> here. >> >> Signed-off-by: Xin Hao >> --- >> mm/damon/sysfs.c | 6 ++---- >> 1 file changed, 2 insertions(+), 4 deletions(-) >> >> diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c >> index 0cca1909bf67..b852a75b9f39 100644 >> --- a/mm/damon/sysfs.c >> +++ b/mm/damon/sysfs.c >> @@ -1109,9 +1109,8 @@ static ssize_t start_store(struct kobject *kobj, struct kobj_attribute *attr, >> { >> struct damon_sysfs_region *region = container_of(kobj, >> struct damon_sysfs_region, kobj); >> - int err = kstrtoul(buf, 0, ®ion->start); >> >> - if (err) >> + if (kstrtoul(buf, 0, ®ion->start)) >> return -EINVAL; > Good finding. But, I'd like to let the user know why it really fails by giving > them the error code that returned by 'kstrtoul()' here. Let's keep the 'err' > but return 'err' here. Ok,  it make sense. > >> return count; >> } >> @@ -1130,9 +1129,8 @@ static ssize_t end_store(struct kobject *kobj, struct kobj_attribute *attr, >> { >> struct damon_sysfs_region *region = container_of(kobj, >> struct damon_sysfs_region, kobj); >> - int err = kstrtoul(buf, 0, ®ion->end); >> >> - if (err) >> + if (kstrtoul(buf, 0, ®ion->end)) >> return -EINVAL; > ditto. > >> return count; >> } >> -- >> 2.31.0 > > Thanks, > SJ