Skip to content

Commit 0e37fc2

Browse files
authored
Merge pull request #10097 from 0xc0170/rollup
Rollup PRs: simple fixes
2 parents 0861709 + 9b1b54d commit 0e37fc2

File tree

17 files changed

+29
-39
lines changed

17 files changed

+29
-39
lines changed

TEST_APPS/device/socket_app/cmd_socket.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,7 @@ static nsapi_size_or_error_t start_udp_receiver_thread(SInfo *info, int argc, ch
673673
int *packetSizes = new (nothrow) int[PACKET_SIZE_ARRAY_LEN];
674674
if (!packetSizes) {
675675
cmd_printf("Allocation failed\r\n");
676+
free(dataIn);
676677
return CMDLINE_RETCODE_FAIL;
677678
}
678679
for (int i = 0; i < PACKET_SIZE_ARRAY_LEN; i++) {

UNITTESTS/features/cellular/framework/AT/at_cellularnetwork/at_cellularnetworktest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,15 @@ TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_get_registration_params)
122122
EXPECT_TRUE(reg_params._status == CellularNetwork::RegistrationDenied);
123123
EXPECT_TRUE(reg_params._act == CellularNetwork::RAT_EGPRS);
124124
EXPECT_TRUE(reg_params._cell_id == -1);
125+
EXPECT_TRUE(reg_params._lac == -1);
125126

126127
ATHandler_stub::read_string_index = 4;
127128
ATHandler_stub::read_string_table[3] = "00C3";
128129
ATHandler_stub::read_string_table[2] = "1234FFC1";//== cellid and in dec: 305463233
129130
ATHandler_stub::read_string_table[1] = "00100100";
130131
ATHandler_stub::read_string_table[0] = "01000111";
131132
EXPECT_TRUE(NSAPI_ERROR_OK == cn.get_registration_params(CellularNetwork::C_EREG, reg_params));
133+
EXPECT_TRUE(reg_params._lac == 0xc3);
132134
EXPECT_TRUE(reg_params._cell_id == 305463233);
133135
EXPECT_TRUE(reg_params._active_time == 240);
134136
EXPECT_TRUE(reg_params._periodic_tau == 70 * 60 * 60);

features/FEATURE_BLE/source/generic/GenericSecurityManager.tpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,9 +883,8 @@ ble_error_t GenericSecurityManager<TPalSecurityManager, SigningMonitor>::init_si
883883
const csrk_t *pcsrk = _db->get_local_csrk();
884884
sign_count_t local_sign_counter = _db->get_local_sign_counter();
885885

886+
csrk_t csrk;
886887
if (!pcsrk) {
887-
csrk_t csrk;
888-
889888
ble_error_t ret = get_random_data(csrk.data(), csrk.size());
890889
if (ret != BLE_ERROR_NONE) {
891890
return ret;

features/cellular/framework/AT/AT_CellularNetwork.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ void AT_CellularNetwork::read_reg_params_and_compare(RegistrationType type)
177177
}
178178
if (reg_params._cell_id != -1 && reg_params._cell_id != _reg_params._cell_id) {
179179
_reg_params._cell_id = reg_params._cell_id;
180+
_reg_params._lac = reg_params._lac;
180181
data.status_data = reg_params._cell_id;
181182
_connection_status_cb((nsapi_event_t)CellularCellIDChanged, (intptr_t)&data);
182183
}

features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ nsapi_size_or_error_t QUECTEL_BC95_CellularStack::socket_sendto_impl(CellularSoc
190190
_at.write_int(socket->id);
191191
_at.write_int(size);
192192
} else {
193-
delete hexstr;
193+
delete [] hexstr;
194194
return NSAPI_ERROR_PARAMETER;
195195
}
196196

@@ -202,7 +202,7 @@ nsapi_size_or_error_t QUECTEL_BC95_CellularStack::socket_sendto_impl(CellularSoc
202202
sent_len = _at.read_int();
203203
_at.resp_stop();
204204

205-
delete hexstr;
205+
delete [] hexstr;
206206

207207
if (_at.get_last_error() == NSAPI_ERROR_OK) {
208208
return sent_len;

features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "QUECTEL_BG96_CellularStack.h"
2121
#include "QUECTEL_BG96_CellularInformation.h"
2222
#include "QUECTEL_BG96_CellularContext.h"
23+
#include "CellularLog.h"
2324

2425
using namespace mbed;
2526
using namespace events;

targets/TARGET_Atmel/TARGET_SAM_CortexM0P/TARGET_SAML21J18A/analogout_api.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include "PeripheralPins.h"
2222
#include "dac.h"
2323

24+
#if DEVICE_ANALOGOUT
25+
2426
extern uint8_t g_sys_init;
2527

2628
#define MAX_VAL_12BIT 0x0FFF /*12 Bit DAC for SAML21*/
@@ -119,4 +121,5 @@ const PinMap *analogout_pinmap()
119121
{
120122
return PinMap_DAC;
121123
}
122-
#endif
124+
125+
#endif // DEVICE_ANALOGOUT

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8C62XX/TARGET_MCU_PSOC6_M0/system_psoc6_cm0plus.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,6 @@ void mailbox_init(void);
193193
*******************************************************************************/
194194
void SystemInit(void)
195195
{
196-
/* Workaround to avoid twice SystemInit() call when ARMC5 compiler is used */
197-
static uint32_t temp_var = 0;
198-
199-
if (temp_var == 0)
200-
{
201-
temp_var = 1;
202-
203196
Cy_PDL_Init(CY_DEVICE_CFG);
204197

205198
/* Restore FLL registers to the default state as they are not restored by the ROM code */
@@ -299,8 +292,6 @@ void SystemInit(void)
299292
#else/* !defined(CY_IPC_DEFAULT_CFG_DISABLE) */
300293
Cy_SemaIpcFlashInit();
301294
#endif /* !defined(CY_IPC_DEFAULT_CFG_DISABLE) */
302-
303-
}
304295
}
305296

306297

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8C62XX/device/system_psoc6.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -539,11 +539,7 @@ extern "C" {
539539
* \addtogroup group_system_config_system_functions
540540
* \{
541541
*/
542-
#if defined(__ARMCC_VERSION)
543-
extern void SystemInit(void) __attribute__((constructor));
544-
#else
545-
extern void SystemInit(void);
546-
#endif /* (__ARMCC_VERSION) */
542+
extern void SystemInit(void);
547543

548544
extern void SystemCoreClockUpdate(void);
549545
/** \} group_system_config_system_functions */

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_4343W/device/system_psoc6.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -539,11 +539,7 @@ extern "C" {
539539
* \addtogroup group_system_config_system_functions
540540
* \{
541541
*/
542-
#if defined(__ARMCC_VERSION)
543-
extern void SystemInit(void) __attribute__((constructor));
544-
#else
545-
extern void SystemInit(void);
546-
#endif /* (__ARMCC_VERSION) */
542+
extern void SystemInit(void);
547543

548544
extern void SystemCoreClockUpdate(void);
549545
/** \} group_system_config_system_functions */

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_BLE/device/system_psoc6.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -539,11 +539,7 @@ extern "C" {
539539
* \addtogroup group_system_config_system_functions
540540
* \{
541541
*/
542-
#if defined(__ARMCC_VERSION)
543-
extern void SystemInit(void) __attribute__((constructor));
544-
#else
545-
extern void SystemInit(void);
546-
#endif /* (__ARMCC_VERSION) */
542+
extern void SystemInit(void);
547543

548544
extern void SystemCoreClockUpdate(void);
549545
/** \} group_system_config_system_functions */

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CMOD_062_4343W/device/system_psoc6.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -539,11 +539,7 @@ extern "C" {
539539
* \addtogroup group_system_config_system_functions
540540
* \{
541541
*/
542-
#if defined(__ARMCC_VERSION)
543-
extern void SystemInit(void) __attribute__((constructor));
544-
#else
545-
extern void SystemInit(void);
546-
#endif /* (__ARMCC_VERSION) */
542+
extern void SystemInit(void);
547543

548544
extern void SystemCoreClockUpdate(void);
549545
/** \} group_system_config_system_functions */

targets/TARGET_GigaDevice/TARGET_GD32E10X/can_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ void can_free(can_t *obj)
305305
*/
306306
int can_frequency(can_t *obj, int hz)
307307
{
308-
int reval;
308+
int reval = 0;
309309

310310
/* The maximum baud rate support to 1M */
311311
if (hz <= 1000000) {

targets/TARGET_GigaDevice/TARGET_GD32F30X/can_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ void can_free(can_t *obj)
305305
*/
306306
int can_frequency(can_t *obj, int hz)
307307
{
308-
int reval;
308+
int reval = 0;
309309

310310
/* The maximum baud rate support to 1M */
311311
if (hz <= 1000000) {

targets/TARGET_GigaDevice/TARGET_GD32F4XX/can_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ void can_free(can_t *obj)
306306
*/
307307
int can_frequency(can_t *obj, int hz)
308308
{
309-
int reval;
309+
int reval = 0;
310310

311311
/* The maximum baud rate support to 1M */
312312
if (hz <= 1000000) {

targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H743xI/TARGET_NUCLEO_H743ZI/PeripheralPins.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ MBED_WEAK const PinMap PinMap_ADC[] = {
106106
{PF_8, ADC_3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC3_INN3
107107
{PF_8_ALT0, ADC_3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC3_INP7
108108
{PF_9, ADC_3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC3_INP2
109-
{PF_10, ADC_3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC3_INN2
110-
{PF_10_ALT0, ADC_3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC3_INP6
109+
{PF_10_ALT0, ADC_3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC3_INN2
110+
{PF_10, ADC_3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC3_INP6
111111
{PF_11, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_INP2
112112
{PF_12, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_INN2
113113
{PF_12_ALT0, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_INP6

targets/TARGET_TOSHIBA/TARGET_TMPM46B/i2c_api.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop)
219219

220220
i2c_num = obj->index;
221221
gI2C_TxData = (char *)calloc(length, sizeof(int8_t));
222+
if (gI2C_TxData == NULL) {
223+
error("Insufficient memory");
224+
return 0;
225+
}
222226

223227
for (i = 0; i < length; i++) {
224228
gI2C_TxData[i] = data[i];
@@ -258,6 +262,10 @@ int i2c_byte_write(i2c_t *obj, int data)
258262
byte_func = 1;
259263
if (start_flag == 0 && send_byte == 0) {
260264
gI2C_LTxData = (char *)realloc(gI2C_LTxData, counter++);
265+
if (gI2C_LTxData == NULL) {
266+
error("Insufficient memory");
267+
return 0;
268+
}
261269
gI2C_LTxData[counter - 2] = data;
262270
}
263271

0 commit comments

Comments
 (0)