Skip to content

Commit 55f4360

Browse files
author
Teppo Järvelin
committed
Cellular: review fixes to cellularfsm and cellularnetwork.
1 parent 1990f63 commit 55f4360

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

features/cellular/easy_cellular/CellularConnectionFSM.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,9 @@ bool CellularConnectionFSM::is_registered_to_plmn()
338338
if (strcmp(_plmn, op_names->numeric)) {
339339
names_list.delete_all();
340340
return true;
341-
} else {
342-
names_list.delete_all();
343-
return false;
344341
}
342+
names_list.delete_all();
343+
return false;
345344
}
346345
}
347346
}

features/cellular/easy_cellular/CellularConnectionFSM.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class CellularConnectionFSM
141141
void set_retry_timeout_array(uint16_t timeout[], int array_len);
142142

143143
/** Sets the operator plmn which is used when registering to a network specified by plmn. If plmn is not set then automatic
144-
* registering is used when registering to a cellular network.
144+
* registering is used when registering to a cellular network. Does not start any operations.
145145
*
146146
* @param plmn operator in numeric format. See more from 3GPP TS 27.007 chapter 7.3.
147147
*/

features/cellular/framework/AT/AT_CellularNetwork.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -902,8 +902,10 @@ nsapi_error_t AT_CellularNetwork::scan_plmn(operList_t &operators, int &opsCount
902902
if (!op) {
903903
tr_warn("Could not allocate new operator");
904904
_at.resp_stop();
905-
opsCount = idx;
906-
return _at.unlock_return_error();
905+
_at.unlock();
906+
operators.delete_all();
907+
opsCount = 0;
908+
return NSAPI_ERROR_NO_MEMORY;
907909
}
908910

909911
op->op_status = (operator_t::Status)_at.read_int();
@@ -1037,8 +1039,9 @@ nsapi_error_t AT_CellularNetwork::get_pdpcontext_params(pdpContextList_t& params
10371039
params = params_list.add_new();
10381040
if (!params) {
10391041
tr_warn("Could not allocate new pdpcontext_params_t");
1040-
params_list.delete_all();
10411042
_at.resp_stop();
1043+
_at.unlock();
1044+
params_list.delete_all();
10421045
free(temp);
10431046
free(ipv6_and_subnetmask);
10441047
return NSAPI_ERROR_NO_MEMORY;
@@ -1194,7 +1197,9 @@ nsapi_error_t AT_CellularNetwork::get_operator_names(operator_names_list &op_nam
11941197
if (!names) {
11951198
tr_warn("Could not allocate new operator_names_t");
11961199
_at.resp_stop();
1197-
return _at.unlock_return_error();
1200+
_at.unlock();
1201+
op_names.delete_all();
1202+
return NSAPI_ERROR_NO_MEMORY;
11981203
}
11991204
_at.read_string(names->numeric, sizeof(names->numeric));
12001205
_at.read_string(names->alpha, sizeof(names->alpha));

0 commit comments

Comments
 (0)