summaryrefslogtreecommitdiffstats
path: root/src/network.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/network.c')
-rw-r--r--src/network.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/network.c b/src/network.c
index 8135fd21..33a1f65a 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1202,8 +1202,12 @@ static void sim_opl_read_cb(struct ofono_modem *modem, int ok,
int total;
GSList *l;
- if (!ok)
+ if (!ok) {
+ if (record > 0)
+ goto optimize;
+
return;
+ }
if (structure != OFONO_SIM_FILE_STRUCTURE_FIXED)
return;
@@ -1218,6 +1222,7 @@ static void sim_opl_read_cb(struct ofono_modem *modem, int ok,
if (record != total)
return;
+optimize:
sim_eons_optimize(netreg->eons);
for (l = netreg->operator_list; l; l = l->next) {
@@ -1241,7 +1246,7 @@ static void sim_pnn_read_cb(struct ofono_modem *modem, int ok,
int total;
if (!ok)
- return;
+ goto check;
if (structure != OFONO_SIM_FILE_STRUCTURE_FIXED)
return;
@@ -1256,11 +1261,12 @@ static void sim_pnn_read_cb(struct ofono_modem *modem, int ok,
sim_eons_add_pnn_record(netreg->eons, record, data, record_length);
+check:
/* If PNN is not present then OPL is not useful, don't
* retrieve it. If OPL is not there then PNN[1] will
* still be used for the HPLMN and/or EHPLMN, if PNN
* is present. */
- if (record == total && !sim_eons_pnn_is_empty(netreg->eons))
+ if ((record == total || !ok) && !sim_eons_pnn_is_empty(netreg->eons))
ofono_sim_read(modem, SIM_EFOPL_FILEID, sim_opl_read_cb, NULL);
}