public inbox for damon@lists.linux.dev
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: kernel test robot <lkp@intel.com>
Cc: SeongJae Park <sj@kernel.org>,
	oe-kbuild@lists.linux.dev, Dan Carpenter <error27@gmail.com>,
	damon@lists.linux.dev
Subject: Re: [sj:damon/next 39/109] mm/damon/sysfs.c:920 damon_sysfs_sample_add_dirs() warn: missing error code 'err'
Date: Mon, 29 Dec 2025 22:37:58 -0800	[thread overview]
Message-ID: <20251230063759.98547-1-sj@kernel.org> (raw)
In-Reply-To: <202512271918.xuSlfGd4-lkp@intel.com>

On Sat, 27 Dec 2025 19:50:14 +0800 kernel test robot <lkp@intel.com> wrote:

> BCC: lkp@intel.com
> CC: oe-kbuild-all@lists.linux.dev
> TO: SeongJae Park <sj@kernel.org>
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/sj/linux.git damon/next
> head:   1d3e0ce41f6d1140a6ca73d505b536f2edc92e40
> commit: 4cba4bd330b3be68e2624d824965554e1ba6a48c [39/109] mm/damon/sysfs: implement sample/filters/ directory
> :::::: branch date: 16 hours ago
> :::::: commit date: 2 days ago
> config: x86_64-randconfig-161-20251227 (https://download.01.org/0day-ci/archive/20251227/202512271918.xuSlfGd4-lkp@intel.com/config)
> compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
> rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <error27@gmail.com>
> | Closes: https://lore.kernel.org/r/202512271918.xuSlfGd4-lkp@intel.com/
> 
> smatch warnings:
> mm/damon/sysfs.c:920 damon_sysfs_sample_add_dirs() warn: missing error code 'err'
> 
> vim +/err +920 mm/damon/sysfs.c
> 
> 399d9187753ad1 SeongJae Park 2025-12-02  900  
> 381d987c8a405a SeongJae Park 2025-12-02  901  static int damon_sysfs_sample_add_dirs(
> 381d987c8a405a SeongJae Park 2025-12-02  902  		struct damon_sysfs_sample *sample)
> 381d987c8a405a SeongJae Park 2025-12-02  903  {
> 381d987c8a405a SeongJae Park 2025-12-02  904  	struct damon_sysfs_primitives *primitives;
> 4cba4bd330b3be SeongJae Park 2025-12-02  905  	struct damon_sysfs_sample_filters *filters;
> 381d987c8a405a SeongJae Park 2025-12-02  906  	int err;
> 381d987c8a405a SeongJae Park 2025-12-02  907  
> 381d987c8a405a SeongJae Park 2025-12-02  908  	primitives = damon_sysfs_primitives_alloc(true, false);
> 381d987c8a405a SeongJae Park 2025-12-02  909  	if (!primitives)
> 381d987c8a405a SeongJae Park 2025-12-02  910  		return -ENOMEM;
> 381d987c8a405a SeongJae Park 2025-12-02  911  	err = kobject_init_and_add(&primitives->kobj,
> 381d987c8a405a SeongJae Park 2025-12-02  912  			&damon_sysfs_primitives_ktype, &sample->kobj,
> 381d987c8a405a SeongJae Park 2025-12-02  913  			"primitives");
> 381d987c8a405a SeongJae Park 2025-12-02  914  	if (err)
> 381d987c8a405a SeongJae Park 2025-12-02  915  		goto put_primitives_out;
> 381d987c8a405a SeongJae Park 2025-12-02  916  	sample->primitives = primitives;
> 381d987c8a405a SeongJae Park 2025-12-02  917  
> 4cba4bd330b3be SeongJae Park 2025-12-02  918  	filters = damon_sysfs_sample_filters_alloc();
> 4cba4bd330b3be SeongJae Park 2025-12-02  919  	if (!filters)
> 4cba4bd330b3be SeongJae Park 2025-12-02 @920  		goto put_primitives_out;
> 4cba4bd330b3be SeongJae Park 2025-12-02  921  	err = kobject_init_and_add(&filters->kobj,
> 4cba4bd330b3be SeongJae Park 2025-12-02  922  			&damon_sysfs_sample_filters_ktype, &sample->kobj,
> 4cba4bd330b3be SeongJae Park 2025-12-02  923  			"filters");
> 4cba4bd330b3be SeongJae Park 2025-12-02  924  	if (err)
> 4cba4bd330b3be SeongJae Park 2025-12-02  925  		goto put_filters_out;
> 4cba4bd330b3be SeongJae Park 2025-12-02  926  	sample->filters = filters;
> 4cba4bd330b3be SeongJae Park 2025-12-02  927  	return 0;
> 4cba4bd330b3be SeongJae Park 2025-12-02  928  put_filters_out:
> 4cba4bd330b3be SeongJae Park 2025-12-02  929  	kobject_put(&filters->kobj);
> 4cba4bd330b3be SeongJae Park 2025-12-02  930  	sample->filters = NULL;
> 381d987c8a405a SeongJae Park 2025-12-02  931  put_primitives_out:
> 381d987c8a405a SeongJae Park 2025-12-02  932  	kobject_put(&primitives->kobj);
> 381d987c8a405a SeongJae Park 2025-12-02  933  	sample->primitives = NULL;
> 381d987c8a405a SeongJae Park 2025-12-02  934  	return err;
> 381d987c8a405a SeongJae Park 2025-12-02  935  }
> 381d987c8a405a SeongJae Park 2025-12-02  936  

Nice catch, thank you for reporting this!  I just pushed below fixup.

diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index d05083572452..cf0ae45d0a04 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -1233,8 +1233,10 @@ static int damon_sysfs_sample_add_dirs(
        sample->primitives = primitives;

        filters = damon_sysfs_sample_filters_alloc();
-       if (!filters)
+       if (!filters) {
+               err = -ENOMEM;
                goto put_primitives_out;
+       }
        err = kobject_init_and_add(&filters->kobj,
                        &damon_sysfs_sample_filters_ktype, &sample->kobj,
                        "filters");


Thanks,
SJ

[...]

           reply	other threads:[~2025-12-30  6:38 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <202512271918.xuSlfGd4-lkp@intel.com>]

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=20251230063759.98547-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=damon@lists.linux.dev \
    --cc=error27@gmail.com \
    --cc=lkp@intel.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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