diff options
author | Aleksander Morgado <aleksandermj@chromium.org> | 2024-03-07 09:09:09 +0000 |
---|---|---|
committer | Aleksander Morgado <aleksandermj@chromium.org> | 2024-03-12 10:15:59 +0000 |
commit | f90778df437d4dbc63bf6415e11b0bbf783efdf5 (patch) | |
tree | f2dc89e95f61bdad69b41b641001312e13a23ea3 | |
parent | 7c2aed6d520453392124cf929b36a7897e2de37d (diff) |
port-probe: switch command error handling to g_autoptr
-rw-r--r-- | src/mm-port-probe.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/mm-port-probe.c b/src/mm-port-probe.c index 489c296f..548b5bdc 100644 --- a/src/mm-port-probe.c +++ b/src/mm-port-probe.c @@ -990,10 +990,10 @@ serial_probe_at_parse_response (MMPortSerialAt *port, GAsyncResult *res, MMPortProbe *self) { - GVariant *result = NULL; - GError *result_error = NULL; + g_autoptr(GVariant) result = NULL; + g_autoptr(GError) result_error = NULL; g_autofree gchar *response = NULL; - GError *error = NULL; + g_autoptr(GError) command_error = NULL; PortProbeRunContext *ctx; g_assert (self->priv->task); @@ -1011,12 +1011,12 @@ serial_probe_at_parse_response (MMPortSerialAt *port, return; } - response = mm_port_serial_at_command_finish (port, res, &error); + response = mm_port_serial_at_command_finish (port, res, &command_error); if (!ctx->at_commands->response_processor (ctx->at_commands->command, response, !!ctx->at_commands[1].command, - error, + command_error, &result, &result_error)) { /* Were we told to abort the whole probing? */ @@ -1028,7 +1028,7 @@ serial_probe_at_parse_response (MMPortSerialAt *port, mm_kernel_device_get_subsystem (self->priv->port), mm_kernel_device_get_name (self->priv->port), result_error->message)); - goto out; + return; } /* Go on to next command */ @@ -1039,7 +1039,7 @@ serial_probe_at_parse_response (MMPortSerialAt *port, ctx->at_result_processor (self, NULL); /* Reschedule */ serial_probe_schedule (self); - goto out; + return; } /* Schedule the next command in the probing group */ @@ -1050,7 +1050,7 @@ serial_probe_at_parse_response (MMPortSerialAt *port, ctx->at_commands_wait_secs); ctx->source_id = g_timeout_add_seconds (ctx->at_commands_wait_secs, (GSourceFunc) serial_probe_at, self); } - goto out; + return; } /* Run result processor. @@ -1059,11 +1059,6 @@ serial_probe_at_parse_response (MMPortSerialAt *port, /* Reschedule probing */ serial_probe_schedule (self); - -out: - g_clear_pointer (&result, g_variant_unref); - g_clear_error (&error); - g_clear_error (&result_error); } static gboolean |