From c51d2e704a1c89d504b379b133bd552c3387fa6c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 24 Jan 2021 14:32:45 -0700 Subject: dm: core: Avoid partially removing devices At present if device_remove() decides that the device should not actually be removed, it still calls the uclass pre_remove() method and powers the device down. Signed-off-by: Simon Glass --- test/dm/virtio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test/dm/virtio.c') diff --git a/test/dm/virtio.c b/test/dm/virtio.c index ad355981cf..9a7e658cce 100644 --- a/test/dm/virtio.c +++ b/test/dm/virtio.c @@ -123,7 +123,9 @@ static int dm_test_virtio_remove(struct unit_test_state *uts) /* check the device can be successfully removed */ dev_or_flags(dev, DM_FLAG_ACTIVATED); - ut_assertok(device_remove(bus, DM_REMOVE_ACTIVE_ALL)); + ut_asserteq(-EKEYREJECTED, device_remove(bus, DM_REMOVE_ACTIVE_ALL)); + + ut_asserteq(false, device_active(dev)); return 0; } -- cgit v1.2.3