- if (!r && !(dm_flags() & req_flags)) {
- log_err(cd, _("Kernel doesn't support loop-AES compatible mapping.\n"));
+ if (r) {
+ free(cipher);
+ return r;
+ }
+
+ log_dbg(cd, "Trying to activate loop-AES device %s using cipher %s.",
+ name, cipher);
+
+ r = dm_create_device(cd, name, CRYPT_LOOPAES, &dmd);
+
+ if (r < 0 && !dm_flags(cd, DM_CRYPT, &dmc_flags) &&
+ (dmc_flags & req_flags) != req_flags) {
+ log_err(cd, _("Kernel does not support loop-AES compatible mapping."));