summaryrefslogtreecommitdiff
path: root/src/sim.c
diff options
context:
space:
mode:
authorSlava Monich <slava.monich@jolla.com>2017-01-05 15:28:56 +0300
committerDenis Kenzior <denkenz@gmail.com>2017-01-06 12:25:48 -0600
commitaaf70beb0653fed6aeb87c91534431bdf75da955 (patch)
treec172f5a5213ea048d30fef48fa1e8fa2992be21c /src/sim.c
parent567e5ec9fca6990f22b2febc0ca54b74cfd3f1b1 (diff)
downloadofono-aaf70beb0653fed6aeb87c91534431bdf75da955.tar.gz
sim: Stop facility lock query sequence on removal
SIM card can be removed while the query is in progress. There's still a remote possibility that SIM card is removed and inserted back while the query is pending, that would start the second query sequence and end up invoking sim_initialize() twice. But at least these checks reduce the probability of something like that happening.
Diffstat (limited to 'src/sim.c')
-rw-r--r--src/sim.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/sim.c b/src/sim.c
index edd7c763..63c7b3c8 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -2466,6 +2466,9 @@ static void sim_query_fac_pinlock_cb(const struct ofono_error *error,
{
struct ofono_sim *sim = data;
+ if (sim->state == OFONO_SIM_STATE_NOT_PRESENT)
+ return;
+
if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
goto done;
@@ -2480,6 +2483,9 @@ static void sim_query_fac_networklock_cb(const struct ofono_error *error,
{
struct ofono_sim *sim = data;
+ if (sim->state == OFONO_SIM_STATE_NOT_PRESENT)
+ return;
+
if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
goto done;
@@ -2496,6 +2502,9 @@ static void sim_query_fac_imsilock_cb(const struct ofono_error *error,
{
struct ofono_sim *sim = data;
+ if (sim->state == OFONO_SIM_STATE_NOT_PRESENT)
+ return;
+
if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
goto done;