mm/damon/core.c:469 __damon_stop() warn: if();

From: kernel test robot
Date: Mon Mar 21 2022 - 11:06:16 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f443e374ae131c168a065ea1748feac6b2e76613
commit: e1edc277e6f6dfb372216522dfc57f9381c39e35 linux/container_of.h: switch to static_assert
date: 4 months ago
config: nds32-randconfig-m031-20220320 (https://download.01.org/0day-ci/archive/20220321/202203212359.HWkV7SP9-lkp@xxxxxxxxx/config)
compiler: nds32le-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

smatch warnings:
mm/damon/core.c:469 __damon_stop() warn: if();

vim +469 mm/damon/core.c

2224d8485492e49 SeongJae Park 2021-09-07 456
2224d8485492e49 SeongJae Park 2021-09-07 457 /*
2224d8485492e49 SeongJae Park 2021-09-07 458 * __damon_stop() - Stops monitoring of given context.
2224d8485492e49 SeongJae Park 2021-09-07 459 * @ctx: monitoring context
2224d8485492e49 SeongJae Park 2021-09-07 460 *
2224d8485492e49 SeongJae Park 2021-09-07 461 * Return: 0 on success, negative error code otherwise.
2224d8485492e49 SeongJae Park 2021-09-07 462 */
2224d8485492e49 SeongJae Park 2021-09-07 463 static int __damon_stop(struct damon_ctx *ctx)
2224d8485492e49 SeongJae Park 2021-09-07 464 {
0f91d13366a4024 Changbin Du 2021-11-05 465 struct task_struct *tsk;
0f91d13366a4024 Changbin Du 2021-11-05 466
2224d8485492e49 SeongJae Park 2021-09-07 467 mutex_lock(&ctx->kdamond_lock);
0f91d13366a4024 Changbin Du 2021-11-05 468 tsk = ctx->kdamond;
0f91d13366a4024 Changbin Du 2021-11-05 @469 if (tsk) {
0f91d13366a4024 Changbin Du 2021-11-05 470 get_task_struct(tsk);
2224d8485492e49 SeongJae Park 2021-09-07 471 mutex_unlock(&ctx->kdamond_lock);
0f91d13366a4024 Changbin Du 2021-11-05 472 kthread_stop(tsk);
0f91d13366a4024 Changbin Du 2021-11-05 473 put_task_struct(tsk);
2224d8485492e49 SeongJae Park 2021-09-07 474 return 0;
2224d8485492e49 SeongJae Park 2021-09-07 475 }
2224d8485492e49 SeongJae Park 2021-09-07 476 mutex_unlock(&ctx->kdamond_lock);
2224d8485492e49 SeongJae Park 2021-09-07 477
2224d8485492e49 SeongJae Park 2021-09-07 478 return -EPERM;
2224d8485492e49 SeongJae Park 2021-09-07 479 }
2224d8485492e49 SeongJae Park 2021-09-07 480

:::::: The code at line 469 was first introduced by commit
:::::: 0f91d13366a402420bf98eaaf393db03946c13e0 mm/damon: simplify stop mechanism

:::::: TO: Changbin Du <changbin.du@xxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://01.org/lkp