error: Drop some obviously superfluous error_propagate()

When error_propagate(errp, local_err) is the only reader of
@local_err, we can just as well change its writers to write @errp
directly, and drop the error_propagate() along with @local_err.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20221121085054.683122-2-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
Markus Armbruster 2022-11-21 09:50:45 +01:00
parent 3d558330ad
commit 6c37ebf330
3 changed files with 11 additions and 19 deletions

View file

@ -2771,24 +2771,20 @@ static void virt_dimm_unplug_request(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp) DeviceState *dev, Error **errp)
{ {
VirtMachineState *vms = VIRT_MACHINE(hotplug_dev); VirtMachineState *vms = VIRT_MACHINE(hotplug_dev);
Error *local_err = NULL;
if (!vms->acpi_dev) { if (!vms->acpi_dev) {
error_setg(&local_err, error_setg(errp,
"memory hotplug is not enabled: missing acpi-ged device"); "memory hotplug is not enabled: missing acpi-ged device");
goto out; return;
} }
if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) { if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) {
error_setg(&local_err, error_setg(errp, "nvdimm device hot unplug is not supported yet.");
"nvdimm device hot unplug is not supported yet."); return;
goto out;
} }
hotplug_handler_unplug_request(HOTPLUG_HANDLER(vms->acpi_dev), dev, hotplug_handler_unplug_request(HOTPLUG_HANDLER(vms->acpi_dev), dev,
&local_err); errp);
out:
error_propagate(errp, local_err);
} }
static void virt_dimm_unplug(HotplugHandler *hotplug_dev, static void virt_dimm_unplug(HotplugHandler *hotplug_dev,

View file

@ -2404,7 +2404,6 @@ static const TypeInfo vmbus_dev_type_info = {
static void vmbus_realize(BusState *bus, Error **errp) static void vmbus_realize(BusState *bus, Error **errp)
{ {
int ret = 0; int ret = 0;
Error *local_err = NULL;
VMBus *vmbus = VMBUS(bus); VMBus *vmbus = VMBUS(bus);
qemu_mutex_init(&vmbus->rx_queue_lock); qemu_mutex_init(&vmbus->rx_queue_lock);
@ -2415,13 +2414,13 @@ static void vmbus_realize(BusState *bus, Error **errp)
ret = hyperv_set_msg_handler(VMBUS_MESSAGE_CONNECTION_ID, ret = hyperv_set_msg_handler(VMBUS_MESSAGE_CONNECTION_ID,
vmbus_recv_message, vmbus); vmbus_recv_message, vmbus);
if (ret != 0) { if (ret != 0) {
error_setg(&local_err, "hyperv set message handler failed: %d", ret); error_setg(errp, "hyperv set message handler failed: %d", ret);
goto error_out; goto error_out;
} }
ret = event_notifier_init(&vmbus->notifier, 0); ret = event_notifier_init(&vmbus->notifier, 0);
if (ret != 0) { if (ret != 0) {
error_setg(&local_err, "event notifier failed to init with %d", ret); error_setg(errp, "event notifier failed to init with %d", ret);
goto remove_msg_handler; goto remove_msg_handler;
} }
@ -2429,7 +2428,7 @@ static void vmbus_realize(BusState *bus, Error **errp)
ret = hyperv_set_event_flag_handler(VMBUS_EVENT_CONNECTION_ID, ret = hyperv_set_event_flag_handler(VMBUS_EVENT_CONNECTION_ID,
&vmbus->notifier); &vmbus->notifier);
if (ret != 0) { if (ret != 0) {
error_setg(&local_err, "hyperv set event handler failed with %d", ret); error_setg(errp, "hyperv set event handler failed with %d", ret);
goto clear_event_notifier; goto clear_event_notifier;
} }
@ -2441,7 +2440,6 @@ remove_msg_handler:
hyperv_set_msg_handler(VMBUS_MESSAGE_CONNECTION_ID, NULL, NULL); hyperv_set_msg_handler(VMBUS_MESSAGE_CONNECTION_ID, NULL, NULL);
error_out: error_out:
qemu_mutex_destroy(&vmbus->rx_queue_lock); qemu_mutex_destroy(&vmbus->rx_queue_lock);
error_propagate(errp, local_err);
} }
static void vmbus_unrealize(BusState *bus) static void vmbus_unrealize(BusState *bus)

View file

@ -275,13 +275,12 @@ static void acquire_privilege(const char *name, Error **errp)
{ {
HANDLE token = NULL; HANDLE token = NULL;
TOKEN_PRIVILEGES priv; TOKEN_PRIVILEGES priv;
Error *local_err = NULL;
if (OpenProcessToken(GetCurrentProcess(), if (OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &token)) TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &token))
{ {
if (!LookupPrivilegeValue(NULL, name, &priv.Privileges[0].Luid)) { if (!LookupPrivilegeValue(NULL, name, &priv.Privileges[0].Luid)) {
error_setg(&local_err, QERR_QGA_COMMAND_FAILED, error_setg(errp, QERR_QGA_COMMAND_FAILED,
"no luid for requested privilege"); "no luid for requested privilege");
goto out; goto out;
} }
@ -290,13 +289,13 @@ static void acquire_privilege(const char *name, Error **errp)
priv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; priv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
if (!AdjustTokenPrivileges(token, FALSE, &priv, 0, NULL, 0)) { if (!AdjustTokenPrivileges(token, FALSE, &priv, 0, NULL, 0)) {
error_setg(&local_err, QERR_QGA_COMMAND_FAILED, error_setg(errp, QERR_QGA_COMMAND_FAILED,
"unable to acquire requested privilege"); "unable to acquire requested privilege");
goto out; goto out;
} }
} else { } else {
error_setg(&local_err, QERR_QGA_COMMAND_FAILED, error_setg(errp, QERR_QGA_COMMAND_FAILED,
"failed to open privilege token"); "failed to open privilege token");
} }
@ -304,7 +303,6 @@ out:
if (token) { if (token) {
CloseHandle(token); CloseHandle(token);
} }
error_propagate(errp, local_err);
} }
static void execute_async(DWORD WINAPI (*func)(LPVOID), LPVOID opaque, static void execute_async(DWORD WINAPI (*func)(LPVOID), LPVOID opaque,