From mboxrd@z Thu Jan 1 00:00:00 1970 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 018CAC6FA82 for ; Tue, 20 Sep 2022 01:54:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8846E94000A; Mon, 19 Sep 2022 21:54:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8335B940007; Mon, 19 Sep 2022 21:54:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7227794000A; Mon, 19 Sep 2022 21:54:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 62EEF940007 for ; Mon, 19 Sep 2022 21:54:29 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 3653C1C636E for ; Tue, 20 Sep 2022 01:54:29 +0000 (UTC) X-FDA: 79930794258.19.A7E1218 Received: from out30-56.freemail.mail.aliyun.com (out30-56.freemail.mail.aliyun.com [115.124.30.56]) by imf20.hostedemail.com (Postfix) with ESMTP id 730411C0005 for ; Tue, 20 Sep 2022 01:54:28 +0000 (UTC) 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663638868; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X0r/TzeavhfS5LNdTEGxDiLypZGp8G4lWN2M9qarp5w=; b=gnEGBvg4m7hNRxehcE8NZlau3KPHNXnjzcYSLy9lWIHlaowvPyoM55GmiH6QLegUtxOZd5 H6dXyvZlaQbxg2N7Bcv1Id+cLY0LHshs275B8RdpnZV2Lhop16JdC472wbvwYAqcF/Wpkb 5vwyWr9j9cb6mlfdQLgWYx4YWEbVJcs= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of xhao@linux.alibaba.com designates 115.124.30.56 as permitted sender) smtp.mailfrom=xhao@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663638868; a=rsa-sha256; cv=none; b=8rB5sw04D1follu3gn86BKcO257S2w8UoXqCwa8aksB09zR3v2yeCLuZ/1AplDNDQJ0Idr p6BgMJM8qIpmCVL8lg/oOeqGsZCC8R2mCus+mkof0eVKJMOTufSyKjbISEIdRrbw1968qS O4/fsS7DRk4h4nrMVAVX2a7D53J34Fw= X-Rspam-User: Authentication-Results: imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of xhao@linux.alibaba.com designates 115.124.30.56 as permitted sender) smtp.mailfrom=xhao@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com X-Rspamd-Server: rspam04 X-Stat-Signature: id98xa8fhpkzsbn1wn4k413gyyuqk5ky X-Rspamd-Queue-Id: 730411C0005 X-HE-Tag: 1663638868-835361 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: 在 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