diff options
author | Rob Herring <robh@kernel.org> | 2014-05-13 10:07:29 -0500 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2014-05-13 14:11:10 -0500 |
commit | 7d1cdc89c54d2cb8157cf1f36fc65e8583d26484 (patch) | |
tree | 5cc736fc8aa9609bc761f9ae8fb3633c741362d3 /drivers/of | |
parent | d9c6866be8a145e32da616d8dcbae806032d75b5 (diff) | |
download | linux-7d1cdc89c54d2cb8157cf1f36fc65e8583d26484.tar.bz2 |
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) /* Test that a missing irq domain returns -EPROBE_DEFER */ np = of_find_node_by_path("/testcase-data/testcase-device1"); pdev = of_find_device_by_node(np); - if (!pdev) - selftest(0, "device 1 creation failed\n"); + selftest(pdev, "device 1 creation failed\n"); + irq = platform_get_irq(pdev, 0); - if (irq != -EPROBE_DEFER) - selftest(0, "device deferred probe failed - %d\n", irq); + selftest(irq == -EPROBE_DEFER, "device deferred probe failed - %d\n", irq); /* Test that a parsing failure does not return -EPROBE_DEFER */ np = of_find_node_by_path("/testcase-data/testcase-device2"); pdev = of_find_device_by_node(np); - if (!pdev) - selftest(0, "device 2 creation failed\n"); + selftest(pdev, "device 2 creation failed\n"); irq = platform_get_irq(pdev, 0); - if (irq >= 0 || irq == -EPROBE_DEFER) - selftest(0, "device parsing error failed - %d\n", irq); + selftest(irq < 0 && irq != -EPROBE_DEFER, "device parsing error failed - %d\n", irq); - selftest(1, "passed"); } static int __init of_selftest(void) |