[PATCH] broadband-modem: report an error when enabling a modem in FAILED state

Aleksander Morgado aleksander at aleksander.es
Sun Jun 1 23:57:48 PDT 2014


On Sun, Jun 1, 2014 at 3:03 AM, Ben Chan <benchan at chromium.org> wrote:
> If the initialization of the Modem3gpp / ModemCdma interface fails, the
> modem transitions to the FAILED state. But since the Modem interface is
> already initialized and exported over DBus, it is possible to invoke the
> Enable method on the Modem interface. This patch changes
> MMBroadbandModem to report an error if one tries to enable the modem in
> the FAILED state instead of raising an assertion.

Good catch; makes total sense.

Pushed to git master.

> ---
>  src/mm-broadband-modem.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
> index 0747ebe..9386f0b 100644
> --- a/src/mm-broadband-modem.c
> +++ b/src/mm-broadband-modem.c
> @@ -8731,11 +8731,11 @@ enable (MMBaseModem *self,
>      /* Check state before launching modem enabling */
>      switch (MM_BROADBAND_MODEM (self)->priv->modem_state) {
>      case MM_MODEM_STATE_UNKNOWN:
> -    case MM_MODEM_STATE_FAILED:
> -        /* We should never have a UNKNOWN|FAILED->ENABLED transition */
> +        /* We should never have a UNKNOWN->ENABLED transition */
>          g_assert_not_reached ();
>          break;
>
> +    case MM_MODEM_STATE_FAILED:
>      case MM_MODEM_STATE_INITIALIZING:
>          g_simple_async_result_set_error (result,
>                                           MM_CORE_ERROR,
> --
> 1.9.1.423.g4596e3a
>



-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list