[PATCH v2 37/41] test: dm: Restart USB before assuming it is stopped

Simon Glass sjg at chromium.org
Sun Oct 24 01:26:31 CEST 2021


Update the blk test to stop USB first, in case another test has started
it.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

(no changes since v1)

 test/dm/blk.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/test/dm/blk.c b/test/dm/blk.c
index deccf05289b..b5957a20fb0 100644
--- a/test/dm/blk.c
+++ b/test/dm/blk.c
@@ -15,6 +15,9 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+/* Allow resetting the USB-started flag */
+extern char usb_started;
+
 /* Test that block devices can be created */
 static int dm_test_blk_base(struct unit_test_state *uts)
 {
@@ -66,8 +69,11 @@ static int dm_test_blk_usb(struct unit_test_state *uts)
 	struct udevice *usb_dev, *dev;
 	struct blk_desc *dev_desc;
 
+	usb_started = false;
+
 	/* Get a flash device */
 	state_set_skip_delays(true);
+	ut_assertok(usb_stop());
 	ut_assertok(usb_init());
 	ut_assertok(uclass_get_device(UCLASS_MASS_STORAGE, 0, &usb_dev));
 	ut_assertok(blk_get_device_by_str("usb", "0", &dev_desc));
-- 
2.33.0.1079.g6e70778dc9-goog



More information about the U-Boot mailing list