target/arm/kvm: Don't free migration-blocker reason on failure
PATCH 1/1 target/arm/kvm: Don't free migration-blocker reason on failure
The migrate_add_blocker() function documents that if it fails it will free the Error it is passed via its reasonp argument and set reasonp to NULL. That means that in kvm_arm_enable_mte() we don't need to call error_free(mte_migration_blocker) in the failure codepath. Doing so is harmless because error_free(NULL) is permitted and does nothing, but we can remove the unnecessary code.
---
This seems to be the only caller of migrate_add_blocker() that was doing this.
--- target/arm/kvm.c | 1 - 1 file changed, 1 deletion(-)
target/arm/kvm.c +0 -1
@@ -2540,7 +2540,6 @@ void kvm_arm_enable_mte(Object *cpuobj, Error **errp)error_setg (&mte_migration_blocker,"Live migration disabled due to MTE enabled" );if (migrate_add_blocker (&mte_migration_blocker, errp)) { -error_free (mte_migration_blocker);return ; }
Signature · 1 line
2.43.0
Quoted 7 lines · Peter Maydell
The
migrate_add_blocker()function documents that if it fails it will free the Error it is passed via its reasonp argument and set reasonp to NULL. That means that inkvm_arm_enable_mte()we don't need to callerror_free(mte_migration_blocker)in the failure codepath. Doing so is harmless becauseerror_free(NULL)is permitted and does nothing, but we can remove the unnecessary code.
Quoted 8 lines
Signed-off-by Peter Maydell <[email protected]>---
This seems to be the only caller ofmigrate_add_blocker()that was doing this.--- target/arm/kvm.c | 1 - 1 file changed, 1 deletion(-)