diff options
author | Rob Herring <robh@kernel.org> | 2014-05-13 11:07:29 -0400 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2014-05-13 15:11:10 -0400 |
commit | 7d1cdc89c54d2cb8157cf1f36fc65e8583d26484 (patch) | |
tree | 5cc736fc8aa9609bc761f9ae8fb3633c741362d3 /drivers/of | |
parent | d9c6866be8a145e32da616d8dcbae806032d75b5 (diff) |
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: Rob Herring <robh@kernel.org>
Cc: Grant Likely <grant.likely@linaro.org>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/selftest.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c index fe70b86bcffb..c1d7d38009f1 100644 --- a/drivers/of/selftest.c +++ b/drivers/of/selftest.c | |||
@@ -440,22 +440,18 @@ static void __init of_selftest_platform_populate(void) | |||
440 | /* Test that a missing irq domain returns -EPROBE_DEFER */ | 440 | /* Test that a missing irq domain returns -EPROBE_DEFER */ |
441 | np = of_find_node_by_path("/testcase-data/testcase-device1"); | 441 | np = of_find_node_by_path("/testcase-data/testcase-device1"); |
442 | pdev = of_find_device_by_node(np); | 442 | pdev = of_find_device_by_node(np); |
443 | if (!pdev) | 443 | selftest(pdev, "device 1 creation failed\n"); |
444 | selftest(0, "device 1 creation failed\n"); | 444 | |
445 | irq = platform_get_irq(pdev, 0); | 445 | irq = platform_get_irq(pdev, 0); |
446 | if (irq != -EPROBE_DEFER) | 446 | selftest(irq == -EPROBE_DEFER, "device deferred probe failed - %d\n", irq); |
447 | selftest(0, "device deferred probe failed - %d\n", irq); | ||
448 | 447 | ||
449 | /* Test that a parsing failure does not return -EPROBE_DEFER */ | 448 | /* Test that a parsing failure does not return -EPROBE_DEFER */ |
450 | np = of_find_node_by_path("/testcase-data/testcase-device2"); | 449 | np = of_find_node_by_path("/testcase-data/testcase-device2"); |
451 | pdev = of_find_device_by_node(np); | 450 | pdev = of_find_device_by_node(np); |
452 | if (!pdev) | 451 | selftest(pdev, "device 2 creation failed\n"); |
453 | selftest(0, "device 2 creation failed\n"); | ||
454 | irq = platform_get_irq(pdev, 0); | 452 | irq = platform_get_irq(pdev, 0); |
455 | if (irq >= 0 || irq == -EPROBE_DEFER) | 453 | selftest(irq < 0 && irq != -EPROBE_DEFER, "device parsing error failed - %d\n", irq); |
456 | selftest(0, "device parsing error failed - %d\n", irq); | ||
457 | 454 | ||
458 | selftest(1, "passed"); | ||
459 | } | 455 | } |
460 | 456 | ||
461 | static int __init of_selftest(void) | 457 | static int __init of_selftest(void) |