summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-03-25 12:21:56 -0600
committerSimon Glass <sjg@chromium.org>2015-04-18 11:11:19 -0600
commit206d4d2b4b30889678bb6b064002013a427b1501 (patch)
tree9683b0ddd1824d6f21a269fd05099fe934242321 /test
parent39de843352d8c655f23ecff460d5e74101780b7e (diff)
downloadu-boot-imx-206d4d2b4b30889678bb6b064002013a427b1501.zip
u-boot-imx-206d4d2b4b30889678bb6b064002013a427b1501.tar.gz
u-boot-imx-206d4d2b4b30889678bb6b064002013a427b1501.tar.bz2
dm: core: Mark device as active before calling uclass probe() methods
The uclass pre-probe functions may end up calling back into the device in some circumstances. This can fail if recursion takes place. Adjust the ordering so that we mark the device as active early, then retract this later if needed. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
Diffstat (limited to 'test')
-rw-r--r--test/dm/test-uclass.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/dm/test-uclass.c b/test/dm/test-uclass.c
index be91657..7cb37f7 100644
--- a/test/dm/test-uclass.c
+++ b/test/dm/test-uclass.c
@@ -31,6 +31,7 @@ int test_ping(struct udevice *dev, int pingval, int *pingret)
static int test_post_bind(struct udevice *dev)
{
dm_testdrv_op_count[DM_TEST_OP_POST_BIND]++;
+ ut_assert(!device_active(dev));
return 0;
}
@@ -48,7 +49,7 @@ static int test_pre_probe(struct udevice *dev)
dm_testdrv_op_count[DM_TEST_OP_PRE_PROBE]++;
ut_assert(priv);
- ut_assert(!device_active(dev));
+ ut_assert(device_active(dev));
return 0;
}