[PATCH] broadband-modem-mbim: propagate error if MBIM_CID_VISIBLE_PROVIDERS query fails

Aleksander Morgado aleksander at aleksander.es
Fri Feb 28 00:19:35 PST 2014

On 28/02/14 04:41, Ben Chan wrote:
>  src/mm-broadband-modem-mbim.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> diff --git a/src/mm-broadband-modem-mbim.c b/src/mm-broadband-modem-mbim.c
> index 554e717..8cfa12c 100644
> --- a/src/mm-broadband-modem-mbim.c
> +++ b/src/mm-broadband-modem-mbim.c
> @@ -2402,7 +2402,9 @@ modem_3gpp_scan_networks_finish (MMIfaceModem3gpp *self,
>          info_list = mm_3gpp_network_info_list_from_mbim_providers ((const MbimProvider *const *)providers,
>                                                                     n_providers);
>          mbim_provider_array_free (providers);
> -    }
> +    } else
> +        g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
> +
>      return info_list;

This is actually wrong.

This is the _finish() method, and the target of the method is to get the
result or error from the GAsyncResult and propagate it to the output GError.

If the GAsyncResult had an error, it is propagated to the output GError
at the beginning of the method:
    if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT
(res), error))
        return NULL;

If the GAsyncResult didn't have an error, we keep on building the info
list to return. If building the list fails, we *don't* need to propagate
that GError to the GAsyncResult, we just need to make sure that the
output GError gets it, and that is already done implicitly (both
mbim_message_command_done_get_result() and
mbim_message_visible_providers_response_parse() use directly the output
GError to set the possible error).


More information about the ModemManager-devel mailing list