mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 04:23:35 +02:00
PM: runtime: Fix error checking for kunit_device_register()
The kunit_device_register() function never returns NULL, it returns
error pointers. Update the assertions to use
KUNIT_ASSERT_NOT_ERR_OR_NULL() instead of checking for NULL.
Fixes: 7f7acd193b ("PM: runtime: Add basic kunit tests for API contracts")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
384b52ce32
commit
92158fae2e
|
|
@ -14,7 +14,7 @@ static void pm_runtime_depth_test(struct kunit *test)
|
|||
{
|
||||
struct device *dev = kunit_device_register(test, DEVICE_NAME);
|
||||
|
||||
KUNIT_ASSERT_PTR_NE(test, NULL, dev);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev);
|
||||
|
||||
pm_runtime_enable(dev);
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ static void pm_runtime_already_suspended_test(struct kunit *test)
|
|||
{
|
||||
struct device *dev = kunit_device_register(test, DEVICE_NAME);
|
||||
|
||||
KUNIT_ASSERT_PTR_NE(test, NULL, dev);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev);
|
||||
|
||||
pm_runtime_enable(dev);
|
||||
KUNIT_EXPECT_TRUE(test, pm_runtime_suspended(dev));
|
||||
|
|
@ -70,7 +70,7 @@ static void pm_runtime_idle_test(struct kunit *test)
|
|||
{
|
||||
struct device *dev = kunit_device_register(test, DEVICE_NAME);
|
||||
|
||||
KUNIT_ASSERT_PTR_NE(test, NULL, dev);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev);
|
||||
|
||||
pm_runtime_enable(dev);
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ static void pm_runtime_disabled_test(struct kunit *test)
|
|||
{
|
||||
struct device *dev = kunit_device_register(test, DEVICE_NAME);
|
||||
|
||||
KUNIT_ASSERT_PTR_NE(test, NULL, dev);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev);
|
||||
|
||||
/* Never called pm_runtime_enable() */
|
||||
KUNIT_EXPECT_FALSE(test, pm_runtime_enabled(dev));
|
||||
|
|
@ -131,7 +131,7 @@ static void pm_runtime_error_test(struct kunit *test)
|
|||
{
|
||||
struct device *dev = kunit_device_register(test, DEVICE_NAME);
|
||||
|
||||
KUNIT_ASSERT_PTR_NE(test, NULL, dev);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev);
|
||||
|
||||
pm_runtime_enable(dev);
|
||||
KUNIT_EXPECT_TRUE(test, pm_runtime_suspended(dev));
|
||||
|
|
@ -214,7 +214,7 @@ static void pm_runtime_probe_active_test(struct kunit *test)
|
|||
{
|
||||
struct device *dev = kunit_device_register(test, DEVICE_NAME);
|
||||
|
||||
KUNIT_ASSERT_PTR_NE(test, NULL, dev);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev);
|
||||
|
||||
KUNIT_EXPECT_TRUE(test, pm_runtime_status_suspended(dev));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user