summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/network.c8
-rw-r--r--src/sim.c4
2 files changed, 9 insertions, 3 deletions
diff --git a/src/network.c b/src/network.c
index 186b5eec..657c9e80 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1116,7 +1116,7 @@ static void sim_opl_read_cb(struct ofono_modem *modem, int ok,
int record_length, void *userdata)
{
struct network_registration_data *netreg = modem->network_registration;
- int total = length / record_length;
+ int total;
if (!ok)
return;
@@ -1131,6 +1131,8 @@ static void sim_opl_read_cb(struct ofono_modem *modem, int ok,
if (!netreg->eons)
return;
+ total = length / record_length;
+
sim_eons_add_pnn_record(netreg->eons, record, data, record_length);
if (record == total)
@@ -1144,7 +1146,7 @@ static void sim_pnn_read_cb(struct ofono_modem *modem, int ok,
int record_length, void *userdata)
{
struct network_registration_data *netreg = modem->network_registration;
- int total = length / record_length;
+ int total;
if (!ok)
return;
@@ -1158,6 +1160,8 @@ static void sim_pnn_read_cb(struct ofono_modem *modem, int ok,
if (!netreg->eons)
netreg->eons = sim_eons_new(total);
+ total = length / record_length;
+
sim_eons_add_pnn_record(netreg->eons, record, data, record_length);
/* If PNN is not present then OPL is not useful, don't
diff --git a/src/sim.c b/src/sim.c
index a4d87f1b..0daf586f 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -192,7 +192,7 @@ static void sim_msisdn_read_cb(struct ofono_modem *modem, int ok,
int record_length, void *userdata)
{
struct sim_manager_data *sim = modem->sim_manager;
- int total = length / record_length;
+ int total;
struct ofono_phone_number *ph;
int number_len;
int ton_npi;
@@ -206,6 +206,8 @@ static void sim_msisdn_read_cb(struct ofono_modem *modem, int ok,
if (length < 14 || record_length < 14 || length < record_length)
return;
+ total = length / record_length;
+
/* Skip Alpha-Identifier field */
data += record_length - 14;