diff options
author | Samrat Guha Niyogi <samrat.guha.niyogi@intel.com> | 2016-08-09 07:11:10 +0530 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2016-08-08 21:17:22 -0500 |
commit | 27f9da901f3ffe382867db92d009b2e65ca691fc (patch) | |
tree | 482f6f94f8b13862f3f1748ba0878d8019669309 | |
parent | 2ba2ccbee4cc9fbcc75f8bac0f3e65461fb97290 (diff) | |
download | ofono-27f9da901f3ffe382867db92d009b2e65ca691fc.tar.gz |
sim: remove locked_pin reset from sim_free_main_state
-rw-r--r-- | src/sim.c | 26 |
1 files changed, 18 insertions, 8 deletions
@@ -2372,13 +2372,6 @@ static void sim_spn_close(struct ofono_sim *sim) static void sim_free_main_state(struct ofono_sim *sim) { - int i; - - for (i = 0; i < OFONO_SIM_PASSWORD_INVALID; i++) - sim->pin_retries[i] = -1; - - memset(sim->locked_pins, 0, sizeof(sim->locked_pins)); - if (sim->imsi) { g_free(sim->imsi); sim->imsi = NULL; @@ -2549,7 +2542,24 @@ void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted) sim_initialize(sim); } } else { - sim->pin_type = OFONO_SIM_PASSWORD_NONE; + switch (sim->pin_type) { + case OFONO_SIM_PASSWORD_SIM_PIN: + case OFONO_SIM_PASSWORD_SIM_PUK: + case OFONO_SIM_PASSWORD_SIM_PIN2: + case OFONO_SIM_PASSWORD_SIM_PUK2: + sim->pin_type = OFONO_SIM_PASSWORD_NONE; + break; + default: + break; + } + + sim->locked_pins[OFONO_SIM_PASSWORD_SIM_PIN] = FALSE; + sim->locked_pins[OFONO_SIM_PASSWORD_SIM_PIN2] = FALSE; + + sim->pin_retries[OFONO_SIM_PASSWORD_SIM_PIN] = -1; + sim->pin_retries[OFONO_SIM_PASSWORD_SIM_PUK] = -1; + sim->pin_retries[OFONO_SIM_PASSWORD_SIM_PIN2] = -1; + sim->pin_retries[OFONO_SIM_PASSWORD_SIM_PUK2] = -1; sim_free_state(sim); } |