* drivers/base/power/runtime-test.c:22 pm_runtime_depth_test() warn: pm_runtime_get_sync() also returns 1 on success
@ 2026-01-09 11:02 Dan Carpenter
2026-01-09 18:39 ` Brian Norris
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2026-01-09 11:02 UTC (permalink / raw)
To: oe-kbuild, Brian Norris
Cc: lkp, oe-kbuild-all, linux-kernel, Rafael J. Wysocki
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 623fb9912f6af600cda3b6bd166ac738c1115ef4
commit: 7f7acd193ba8aaa8ed07cfadc335bb17a991fd42 PM: runtime: Add basic kunit tests for API contracts
config: x86_64-randconfig-161-20260109 (https://download.01.org/0day-ci/archive/20260109/202601091832.YueBSiOb-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch version: v0.5.0-8985-g2614ff1a
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 <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202601091832.YueBSiOb-lkp@intel.com/
New smatch warnings:
drivers/base/power/runtime-test.c:22 pm_runtime_depth_test() warn: pm_runtime_get_sync() also returns 1 on success
drivers/base/power/runtime-test.c:78 pm_runtime_idle_test() warn: pm_runtime_get_sync() also returns 1 on success
drivers/base/power/runtime-test.c:182 pm_runtime_error_test() warn: pm_runtime_get_sync() also returns 1 on success
Old smatch warnings:
drivers/base/power/runtime-test.c:185 pm_runtime_error_test() warn: pm_runtime_get_sync() also returns 1 on success
vim +22 drivers/base/power/runtime-test.c
7f7acd193ba8aa Brian Norris 2025-09-25 13 static void pm_runtime_depth_test(struct kunit *test)
7f7acd193ba8aa Brian Norris 2025-09-25 14 {
7f7acd193ba8aa Brian Norris 2025-09-25 15 struct device *dev = kunit_device_register(test, DEVICE_NAME);
7f7acd193ba8aa Brian Norris 2025-09-25 16
7f7acd193ba8aa Brian Norris 2025-09-25 17 KUNIT_ASSERT_PTR_NE(test, NULL, dev);
7f7acd193ba8aa Brian Norris 2025-09-25 18
7f7acd193ba8aa Brian Norris 2025-09-25 19 pm_runtime_enable(dev);
7f7acd193ba8aa Brian Norris 2025-09-25 20
7f7acd193ba8aa Brian Norris 2025-09-25 21 KUNIT_EXPECT_TRUE(test, pm_runtime_suspended(dev));
7f7acd193ba8aa Brian Norris 2025-09-25 @22 KUNIT_EXPECT_EQ(test, 0, pm_runtime_get_sync(dev));
Use pm_runtime_resume_and_get()?
7f7acd193ba8aa Brian Norris 2025-09-25 23 KUNIT_EXPECT_TRUE(test, pm_runtime_active(dev));
7f7acd193ba8aa Brian Norris 2025-09-25 24 KUNIT_EXPECT_EQ(test, 1, pm_runtime_get_sync(dev)); /* "already active" */
7f7acd193ba8aa Brian Norris 2025-09-25 25 KUNIT_EXPECT_EQ(test, 0, pm_runtime_put_sync(dev));
7f7acd193ba8aa Brian Norris 2025-09-25 26 KUNIT_EXPECT_EQ(test, 0, pm_runtime_put_sync(dev));
7f7acd193ba8aa Brian Norris 2025-09-25 27 KUNIT_EXPECT_TRUE(test, pm_runtime_suspended(dev));
7f7acd193ba8aa Brian Norris 2025-09-25 28 }
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: drivers/base/power/runtime-test.c:22 pm_runtime_depth_test() warn: pm_runtime_get_sync() also returns 1 on success
2026-01-09 11:02 drivers/base/power/runtime-test.c:22 pm_runtime_depth_test() warn: pm_runtime_get_sync() also returns 1 on success Dan Carpenter
@ 2026-01-09 18:39 ` Brian Norris
0 siblings, 0 replies; 2+ messages in thread
From: Brian Norris @ 2026-01-09 18:39 UTC (permalink / raw)
To: Dan Carpenter
Cc: oe-kbuild, lkp, oe-kbuild-all, linux-kernel, Rafael J. Wysocki
On Fri, Jan 09, 2026 at 02:02:09PM +0300, Dan Carpenter wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 623fb9912f6af600cda3b6bd166ac738c1115ef4
> commit: 7f7acd193ba8aaa8ed07cfadc335bb17a991fd42 PM: runtime: Add basic kunit tests for API contracts
> config: x86_64-randconfig-161-20260109 (https://download.01.org/0day-ci/archive/20260109/202601091832.YueBSiOb-lkp@intel.com/config)
> compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
> smatch version: v0.5.0-8985-g2614ff1a
>
> 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 <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202601091832.YueBSiOb-lkp@intel.com/
>
> New smatch warnings:
> drivers/base/power/runtime-test.c:22 pm_runtime_depth_test() warn: pm_runtime_get_sync() also returns 1 on success
> drivers/base/power/runtime-test.c:78 pm_runtime_idle_test() warn: pm_runtime_get_sync() also returns 1 on success
> drivers/base/power/runtime-test.c:182 pm_runtime_error_test() warn: pm_runtime_get_sync() also returns 1 on success
>
> Old smatch warnings:
> drivers/base/power/runtime-test.c:185 pm_runtime_error_test() warn: pm_runtime_get_sync() also returns 1 on success
FWIW, these are all false positives. These are unit tests which are
purposely exercising the return codes of this notably-complex API under
controlled conditions.
Brian
> vim +22 drivers/base/power/runtime-test.c
>
> 7f7acd193ba8aa Brian Norris 2025-09-25 13 static void pm_runtime_depth_test(struct kunit *test)
> 7f7acd193ba8aa Brian Norris 2025-09-25 14 {
> 7f7acd193ba8aa Brian Norris 2025-09-25 15 struct device *dev = kunit_device_register(test, DEVICE_NAME);
> 7f7acd193ba8aa Brian Norris 2025-09-25 16
> 7f7acd193ba8aa Brian Norris 2025-09-25 17 KUNIT_ASSERT_PTR_NE(test, NULL, dev);
> 7f7acd193ba8aa Brian Norris 2025-09-25 18
> 7f7acd193ba8aa Brian Norris 2025-09-25 19 pm_runtime_enable(dev);
> 7f7acd193ba8aa Brian Norris 2025-09-25 20
> 7f7acd193ba8aa Brian Norris 2025-09-25 21 KUNIT_EXPECT_TRUE(test, pm_runtime_suspended(dev));
> 7f7acd193ba8aa Brian Norris 2025-09-25 @22 KUNIT_EXPECT_EQ(test, 0, pm_runtime_get_sync(dev));
>
> Use pm_runtime_resume_and_get()?
>
> 7f7acd193ba8aa Brian Norris 2025-09-25 23 KUNIT_EXPECT_TRUE(test, pm_runtime_active(dev));
> 7f7acd193ba8aa Brian Norris 2025-09-25 24 KUNIT_EXPECT_EQ(test, 1, pm_runtime_get_sync(dev)); /* "already active" */
> 7f7acd193ba8aa Brian Norris 2025-09-25 25 KUNIT_EXPECT_EQ(test, 0, pm_runtime_put_sync(dev));
> 7f7acd193ba8aa Brian Norris 2025-09-25 26 KUNIT_EXPECT_EQ(test, 0, pm_runtime_put_sync(dev));
> 7f7acd193ba8aa Brian Norris 2025-09-25 27 KUNIT_EXPECT_TRUE(test, pm_runtime_suspended(dev));
> 7f7acd193ba8aa Brian Norris 2025-09-25 28 }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-09 18:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-09 11:02 drivers/base/power/runtime-test.c:22 pm_runtime_depth_test() warn: pm_runtime_get_sync() also returns 1 on success Dan Carpenter
2026-01-09 18:39 ` Brian Norris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox