mirror of
https://github.com/qemu/qemu.git
synced 2026-02-04 05:35:39 +00:00
error: error_free(NULL) is safe, drop unnecessary conditionals
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20251119130855.105479-5-armbru@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
This commit is contained in:
@@ -62,9 +62,7 @@ static int acpi_pcihp_get_bsel(PCIBus *bus)
|
|||||||
&local_err);
|
&local_err);
|
||||||
|
|
||||||
if (local_err || bsel >= ACPI_PCIHP_MAX_HOTPLUG_BUS) {
|
if (local_err || bsel >= ACPI_PCIHP_MAX_HOTPLUG_BUS) {
|
||||||
if (local_err) {
|
error_free(local_err);
|
||||||
error_free(local_err);
|
|
||||||
}
|
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
return bsel;
|
return bsel;
|
||||||
|
|||||||
@@ -932,9 +932,7 @@ static void qio_channel_websock_finalize(Object *obj)
|
|||||||
if (ioc->io_tag) {
|
if (ioc->io_tag) {
|
||||||
g_source_remove(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));
|
object_unref(OBJECT(ioc->master));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,9 +91,7 @@ static void qio_task_free(QIOTask *task)
|
|||||||
if (task->destroyResult) {
|
if (task->destroyResult) {
|
||||||
task->destroyResult(task->result);
|
task->destroyResult(task->result);
|
||||||
}
|
}
|
||||||
if (task->err) {
|
error_free(task->err);
|
||||||
error_free(task->err);
|
|
||||||
}
|
|
||||||
object_unref(task->source);
|
object_unref(task->source);
|
||||||
|
|
||||||
qemu_mutex_unlock(&task->thread_lock);
|
qemu_mutex_unlock(&task->thread_lock);
|
||||||
|
|||||||
@@ -1568,10 +1568,8 @@ bool migrate_has_error(MigrationState *s)
|
|||||||
static void migrate_error_free(MigrationState *s)
|
static void migrate_error_free(MigrationState *s)
|
||||||
{
|
{
|
||||||
QEMU_LOCK_GUARD(&s->error_mutex);
|
QEMU_LOCK_GUARD(&s->error_mutex);
|
||||||
if (s->error) {
|
error_free(s->error);
|
||||||
error_free(s->error);
|
s->error = NULL;
|
||||||
s->error = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void migration_connect_error_propagate(MigrationState *s, Error *error)
|
static void migration_connect_error_propagate(MigrationState *s, Error *error)
|
||||||
|
|||||||
@@ -875,10 +875,7 @@ static void check_parse(MachineState *ms, const SMPConfiguration *config,
|
|||||||
config_str, expect_err, output_topo_str);
|
config_str, expect_err, output_topo_str);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (err != NULL) {
|
error_free(err);
|
||||||
error_free(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user