From: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
To: sj@kernel.org
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
Jiapeng Chong <jiapeng.chong@linux.alibaba.com>,
Abaci Robot <abaci@linux.alibaba.com>
Subject: [PATCH] mm/damon/sysfs: Fix missing error code in damon_sysfs_attrs_add_dirs()
Date: Wed, 2 Mar 2022 19:11:20 +0800 [thread overview]
Message-ID: <20220302111120.24984-1-jiapeng.chong@linux.alibaba.com> (raw)
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 <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
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,
--
2.20.1.7.g153144c
next reply other threads:[~2022-03-02 11:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-02 11:11 Jiapeng Chong [this message]
2022-03-02 11:26 ` SeongJae Park
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=20220302111120.24984-1-jiapeng.chong@linux.alibaba.com \
--to=jiapeng.chong@linux.alibaba.com \
--cc=abaci@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--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