port-probe: switch command error handling to g_autoptr

This commit is contained in:
Aleksander Morgado
2024-03-12 10:15:59 +00:00
parent 7c2aed6d52
commit f90778df43
+8 -13
View File
@@ -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