Skip to contentSkip to conversation

migration: Remove unneeded NULL check from migrate_fd_error()

PATCH Applied Peter Maydell 2 participants 2 messages Oct 21, 2016 – Oct 26, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 migration: Remove unneeded NULL check from migrate_fd_error()

All the callers of migrate_fd_error() pass a non-NULL error parameter, and if any did pass NULL then we would segfault in error_copy(), so remove the unnecessary NULL check earlier in the function.
(Spotted by Coverity.)

---
This seems better than making migrate_fd_error() allow a NULL pointer, which doesn't seem like a useful thing. I'm guessing a bit though, because there's no doc comment for this function in the header file...

---
 migration/migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
migration/migration.c +1 -1
index 4d417b7..d216b93 100644
@@ -922,7 +922,7 @@ static void migrate_fd_cleanup(void *opaque)
 
 void migrate_fd_error(MigrationState *s, const Error *error)
 {
-    trace_migrate_fd_error(error ? error_get_pretty(error) : "");
+    trace_migrate_fd_error(error_get_pretty(error));
     assert(s->to_dst_file == NULL);
     migrate_set_state(&s->state, MIGRATION_STATUS_SETUP,
                       MIGRATION_STATUS_FAILED);
Signature · 1 line
2.7.4