Skip to content

Commit

Permalink
net: lib: nrf_cloud_fota_common: Fix error handling
Browse files Browse the repository at this point in the history
Add missing return on error in case modem shutdown fails, and remove
call to nrf_modem_lib init if image validation fails when the
modem is in bootloader mode. The modem needs to be shutdown before it
can be initialized in normal mode.

Signed-off-by: Simen S. Røstad <[email protected]>
  • Loading branch information
simensrostad committed Sep 13, 2024
1 parent a2afb16 commit 9cbd24b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions subsys/net/lib/nrf_cloud/src/nrf_cloud_fota_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,13 @@ int nrf_cloud_fota_fmfu_apply(void)
err = fmfu_fdev_load(fmfu_buf, sizeof(fmfu_buf), fmfu_dev.dev, fmfu_dev.offset);
if (err != 0) {
LOG_ERR("Failed to apply full modem update, error: %d", err);
(void)nrf_modem_lib_init();
return err;
}

err = nrf_modem_lib_shutdown();
if (err != 0) {
LOG_WRN("nrf_modem_lib_shutdown() failed: %d\n", err);
LOG_WRN("nrf_modem_lib_shutdown() failed: %d", err);
return err;
}

return 0;
Expand Down

0 comments on commit 9cbd24b

Please sign in to comment.