Merge "MetadataCrypt: fix timeout due to missing userdata dm device"
diff --git a/MetadataCrypt.cpp b/MetadataCrypt.cpp
index 0bd6100..6550be4 100644
--- a/MetadataCrypt.cpp
+++ b/MetadataCrypt.cpp
@@ -187,15 +187,14 @@
auto& dm = DeviceMapper::Instance();
if (dm_name == kDmNameUserdata && dm.GetState(dm_name) == DmDeviceState::SUSPENDED) {
// The device was created in advance, populate it now.
- std::string path;
- if (!dm.WaitForDevice(dm_name, 5s, crypto_blkdev)) {
- LOG(ERROR) << "Failed to wait for default-key device " << dm_name;
- return false;
- }
if (!dm.LoadTableAndActivate(dm_name, table)) {
LOG(ERROR) << "Failed to populate default-key device " << dm_name;
return false;
}
+ if (!dm.WaitForDevice(dm_name, 5s, crypto_blkdev)) {
+ LOG(ERROR) << "Failed to wait for default-key device " << dm_name;
+ return false;
+ }
} else if (!dm.CreateDevice(dm_name, table, crypto_blkdev, 5s)) {
LOG(ERROR) << "Could not create default-key device " << dm_name;
return false;