From: haoxin <xhao@linux.alibaba.com>
To: SeongJae Park <sj@kernel.org>
Cc: akpm@linux-foundation.org, damon@lists.linux.dev,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/2] mm/damon/sysfs: remove unnecessary variables
Date: Tue, 20 Sep 2022 09:54:23 +0800 [thread overview]
Message-ID: <ff9f1b54-5d50-a43d-62a7-3e1adadf1974@linux.alibaba.com> (raw)
In-Reply-To: <20220919170305.61335-1-sj@kernel.org>
在 2022/9/20 上午1:03, SeongJae Park 写道:
> On Mon, 19 Sep 2022 23:12:00 +0800 Xin Hao <xhao@linux.alibaba.com> wrote:
>
>> Just do a little change here, the 'err' variable really no need to stay
>> here.
>>
>> Signed-off-by: Xin Hao <xhao@linux.alibaba.com>
>> ---
>> 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
prev parent reply other threads:[~2022-09-20 1:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-19 15:12 [PATCH v1 1/2] mm/damon/sysfs: remove unnecessary variables Xin Hao
2022-09-19 15:12 ` [PATCH v1 2/2] mm/damon/sysfs: use kzmalloc instead kmalloc to simplify codes Xin Hao
2022-09-19 17:22 ` SeongJae Park
2022-09-20 1:58 ` haoxin
2022-09-20 16:25 ` SeongJae Park
2022-09-21 5:20 ` haoxin
2022-09-19 17:03 ` [PATCH v1 1/2] mm/damon/sysfs: remove unnecessary variables SeongJae Park
2022-09-20 1:54 ` haoxin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ff9f1b54-5d50-a43d-62a7-3e1adadf1974@linux.alibaba.com \
--to=xhao@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).