port-probe: switch command error handling to g_autoptr
This commit is contained in:
+8
-13
@@ -990,10 +990,10 @@ serial_probe_at_parse_response (MMPortSerialAt *port,
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
MMPortProbe *self)
|
MMPortProbe *self)
|
||||||
{
|
{
|
||||||
GVariant *result = NULL;
|
g_autoptr(GVariant) result = NULL;
|
||||||
GError *result_error = NULL;
|
g_autoptr(GError) result_error = NULL;
|
||||||
g_autofree gchar *response = NULL;
|
g_autofree gchar *response = NULL;
|
||||||
GError *error = NULL;
|
g_autoptr(GError) command_error = NULL;
|
||||||
PortProbeRunContext *ctx;
|
PortProbeRunContext *ctx;
|
||||||
|
|
||||||
g_assert (self->priv->task);
|
g_assert (self->priv->task);
|
||||||
@@ -1011,12 +1011,12 @@ serial_probe_at_parse_response (MMPortSerialAt *port,
|
|||||||
return;
|
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,
|
if (!ctx->at_commands->response_processor (ctx->at_commands->command,
|
||||||
response,
|
response,
|
||||||
!!ctx->at_commands[1].command,
|
!!ctx->at_commands[1].command,
|
||||||
error,
|
command_error,
|
||||||
&result,
|
&result,
|
||||||
&result_error)) {
|
&result_error)) {
|
||||||
/* Were we told to abort the whole probing? */
|
/* 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_subsystem (self->priv->port),
|
||||||
mm_kernel_device_get_name (self->priv->port),
|
mm_kernel_device_get_name (self->priv->port),
|
||||||
result_error->message));
|
result_error->message));
|
||||||
goto out;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Go on to next command */
|
/* Go on to next command */
|
||||||
@@ -1039,7 +1039,7 @@ serial_probe_at_parse_response (MMPortSerialAt *port,
|
|||||||
ctx->at_result_processor (self, NULL);
|
ctx->at_result_processor (self, NULL);
|
||||||
/* Reschedule */
|
/* Reschedule */
|
||||||
serial_probe_schedule (self);
|
serial_probe_schedule (self);
|
||||||
goto out;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Schedule the next command in the probing group */
|
/* 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->at_commands_wait_secs);
|
||||||
ctx->source_id = g_timeout_add_seconds (ctx->at_commands_wait_secs, (GSourceFunc) serial_probe_at, self);
|
ctx->source_id = g_timeout_add_seconds (ctx->at_commands_wait_secs, (GSourceFunc) serial_probe_at, self);
|
||||||
}
|
}
|
||||||
goto out;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Run result processor.
|
/* Run result processor.
|
||||||
@@ -1059,11 +1059,6 @@ serial_probe_at_parse_response (MMPortSerialAt *port,
|
|||||||
|
|
||||||
/* Reschedule probing */
|
/* Reschedule probing */
|
||||||
serial_probe_schedule (self);
|
serial_probe_schedule (self);
|
||||||
|
|
||||||
out:
|
|
||||||
g_clear_pointer (&result, g_variant_unref);
|
|
||||||
g_clear_error (&error);
|
|
||||||
g_clear_error (&result_error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|||||||
Reference in New Issue
Block a user