From patchwork Wed Mar 2 11:11:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiapeng Chong X-Patchwork-Id: 12765762 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 BA24CC433EF for ; Wed, 2 Mar 2022 11:11:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 17F198D0002; Wed, 2 Mar 2022 06:11:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 12ED98D0001; Wed, 2 Mar 2022 06:11:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 045758D0002; Wed, 2 Mar 2022 06:11:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id EB93D8D0001 for ; Wed, 2 Mar 2022 06:11:35 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id B832424C3E for ; Wed, 2 Mar 2022 11:11:35 +0000 (UTC) X-FDA: 79199180550.11.00FF3D5 Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) by imf27.hostedemail.com (Postfix) with ESMTP id C3E8040009 for ; Wed, 2 Mar 2022 11:11:33 +0000 (UTC) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0V62RRlM_1646219481; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0V62RRlM_1646219481) by smtp.aliyun-inc.com(127.0.0.1); Wed, 02 Mar 2022 19:11:30 +0800 From: Jiapeng Chong To: sj@kernel.org Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Jiapeng Chong , Abaci Robot Subject: [PATCH] mm/damon/sysfs: Fix missing error code in damon_sysfs_attrs_add_dirs() Date: Wed, 2 Mar 2022 19:11:20 +0800 Message-Id: <20220302111120.24984-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: C3E8040009 X-Stat-Signature: cywefj7177a1gz7nakfakojus5pwobgm Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf27.hostedemail.com: domain of jiapeng.chong@linux.alibaba.com designates 115.124.30.43 as permitted sender) smtp.mailfrom=jiapeng.chong@linux.alibaba.com X-Rspam-User: X-HE-Tag: 1646219493-722348 X-Bogosity: Ham, tests=bogofilter, spamicity=0.003639, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The error code is missing in this code scenario, add the error code '-ENOMEM' to the return value 'err'. Eliminate the follow smatch warning: mm/damon/sysfs.c:1647 damon_sysfs_attrs_add_dirs() warn: missing error code 'err'. Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong Reviewed-by: SeongJae Park --- mm/damon/sysfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index 32a9d21c0db5..0eca71163924 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -1643,8 +1643,10 @@ static int damon_sysfs_attrs_add_dirs(struct damon_sysfs_attrs *attrs) attrs->intervals = intervals; nr_regions_range = damon_sysfs_ul_range_alloc(10, 1000); - if (!nr_regions_range) + if (!nr_regions_range) { + err = -ENOMEM; goto put_intervals_out; + } err = kobject_init_and_add(&nr_regions_range->kobj, &damon_sysfs_ul_range_ktype, &attrs->kobj,