|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 4/5] error: error_free(NULL) is safe, drop unnecessary conditionals
Signed-off-by: Markus Armbruster <armbru@xxxxxxxxxx>
---
hw/acpi/pcihp.c | 4 +---
io/channel-websock.c | 4 +---
io/task.c | 4 +---
migration/migration.c | 6 ++----
tests/unit/test-smp-parse.c | 5 +----
5 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
index 4922bbc778..87162ff2c0 100644
--- a/hw/acpi/pcihp.c
+++ b/hw/acpi/pcihp.c
@@ -62,9 +62,7 @@ static int acpi_pcihp_get_bsel(PCIBus *bus)
&local_err);
if (local_err || bsel >= ACPI_PCIHP_MAX_HOTPLUG_BUS) {
- if (local_err) {
- error_free(local_err);
- }
+ error_free(local_err);
return -1;
} else {
return bsel;
diff --git a/io/channel-websock.c b/io/channel-websock.c
index cb4dafdebb..d0929ba232 100644
--- a/io/channel-websock.c
+++ b/io/channel-websock.c
@@ -932,9 +932,7 @@ static void qio_channel_websock_finalize(Object *obj)
if (ioc->io_tag) {
g_source_remove(ioc->io_tag);
}
- if (ioc->io_err) {
- error_free(ioc->io_err);
- }
+ error_free(ioc->io_err);
object_unref(OBJECT(ioc->master));
}
diff --git a/io/task.c b/io/task.c
index 451f26f8b4..da79d31782 100644
--- a/io/task.c
+++ b/io/task.c
@@ -91,9 +91,7 @@ static void qio_task_free(QIOTask *task)
if (task->destroyResult) {
task->destroyResult(task->result);
}
- if (task->err) {
- error_free(task->err);
- }
+ error_free(task->err);
object_unref(task->source);
qemu_mutex_unlock(&task->thread_lock);
diff --git a/migration/migration.c b/migration/migration.c
index c2daab6bdd..3160e24220 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1569,10 +1569,8 @@ bool migrate_has_error(MigrationState *s)
static void migrate_error_free(MigrationState *s)
{
QEMU_LOCK_GUARD(&s->error_mutex);
- if (s->error) {
- error_free(s->error);
- s->error = NULL;
- }
+ error_free(s->error);
+ s->error = NULL;
}
static void migration_connect_set_error(MigrationState *s, const Error *error)
diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c
index 326045ecbb..34082c1465 100644
--- a/tests/unit/test-smp-parse.c
+++ b/tests/unit/test-smp-parse.c
@@ -875,10 +875,7 @@ static void check_parse(MachineState *ms, const
SMPConfiguration *config,
config_str, expect_err, output_topo_str);
end:
- if (err != NULL) {
- error_free(err);
- }
-
+ error_free(err);
abort();
}
--
2.49.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |