Commit 7d1cdc89 authored by Rob Herring's avatar Rob Herring

of/selftest: clean-up of_selftest_platform_populate pass/fail handling

Move the pass/fail checks into selftest() calls instead of a separate if
condition. Unconditionally calling pass was wrong.
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Cc: Grant Likely <grant.likely@linaro.org>
parent d9c6866b
...@@ -440,22 +440,18 @@ static void __init of_selftest_platform_populate(void) ...@@ -440,22 +440,18 @@ static void __init of_selftest_platform_populate(void)
/* Test that a missing irq domain returns -EPROBE_DEFER */ /* Test that a missing irq domain returns -EPROBE_DEFER */
np = of_find_node_by_path("/testcase-data/testcase-device1"); np = of_find_node_by_path("/testcase-data/testcase-device1");
pdev = of_find_device_by_node(np); pdev = of_find_device_by_node(np);
if (!pdev) selftest(pdev, "device 1 creation failed\n");
selftest(0, "device 1 creation failed\n");
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq != -EPROBE_DEFER) selftest(irq == -EPROBE_DEFER, "device deferred probe failed - %d\n", irq);
selftest(0, "device deferred probe failed - %d\n", irq);
/* Test that a parsing failure does not return -EPROBE_DEFER */ /* Test that a parsing failure does not return -EPROBE_DEFER */
np = of_find_node_by_path("/testcase-data/testcase-device2"); np = of_find_node_by_path("/testcase-data/testcase-device2");
pdev = of_find_device_by_node(np); pdev = of_find_device_by_node(np);
if (!pdev) selftest(pdev, "device 2 creation failed\n");
selftest(0, "device 2 creation failed\n");
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq >= 0 || irq == -EPROBE_DEFER) selftest(irq < 0 && irq != -EPROBE_DEFER, "device parsing error failed - %d\n", irq);
selftest(0, "device parsing error failed - %d\n", irq);
selftest(1, "passed");
} }
static int __init of_selftest(void) static int __init of_selftest(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment