Skip to content

Commit 8e85b62

Browse files
MirkoCovizzinordicjm
authored andcommitted
lib: nrf_modem_lib: jump to init callbacks when err
`nrf_modem_lib_init` should not initialize traces or log the firmware version UUID when `nrf_modem_init` fails, because they require the modem library to be initialized. However it should iterate through the init callbacks and report the returned error. Signed-off-by: Mirko Covizzi <[email protected]>
1 parent 8c3501f commit 8e85b62

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,10 @@ Modem libraries
545545

546546
* Updated the :ref:`nrf_modem_lib_lte_net_if` to automatically set the actual link :term:`Maximum Transmission Unit (MTU)` on the network interface when PDN connectivity is gained.
547547

548+
* :ref:`nrf_modem_lib_readme`:
549+
550+
* Fixed a bug where various subsystems would be erroneously initialized during a failed initialization of the library.
551+
548552
Multiprotocol Service Layer libraries
549553
-------------------------------------
550554

lib/nrf_modem_lib/nrf_modem_lib.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ int nrf_modem_lib_init(void)
169169
err = nrf_modem_init(&init_params);
170170
if (err) {
171171
LOG_ERR("Modem library initialization failed, err %d", err);
172+
173+
/* Jump to the init callbacks and pass them the returned error. */
174+
goto init_callbacks;
172175
}
173176

174177
#if CONFIG_NRF_MODEM_LIB_TRACE
@@ -182,6 +185,7 @@ int nrf_modem_lib_init(void)
182185
log_fw_version_uuid();
183186
}
184187

188+
init_callbacks:
185189
STRUCT_SECTION_FOREACH(nrf_modem_lib_init_cb, e) {
186190
LOG_DBG("Modem init callback: %p", e->callback);
187191
e->callback(err, e->context);

0 commit comments

Comments
 (0)