Skip to content

Commit

Permalink
pb: Clean up usage of PB_ERR_MEM
Browse files Browse the repository at this point in the history
This should only be used in memory allocation situations
  • Loading branch information
jonasblixt committed Apr 23, 2023
1 parent 895ade1 commit 9dc2055
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/boot/image_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ int boot_image_auth_header(struct bpak_header *hdr)
rc = bpak_copyz_signature(hdr, signature, &signature_length);

if (rc != BPAK_OK)
return -PB_ERR_MEM;
return -PB_ERR_BUF_TOO_SMALL;

rc = hash_update(hdr, sizeof(*hdr));

Expand Down Expand Up @@ -132,31 +132,31 @@ int boot_image_auth_header(struct bpak_header *hdr)
size_t bytes_to_read = bpak_part_size(p);

if (CHECK_OVERLAP(load_addr, bytes_to_read, stack_start, stack_end)) {
rc = -PB_ERR_MEM;
rc = -PB_ERR;
LOG_ERR("Part 0x%x overlapping with stack segment", p->id);
break;
}

if (CHECK_OVERLAP(load_addr, bytes_to_read, data_start, data_end)) {
rc = -PB_ERR_MEM;
rc = -PB_ERR;
LOG_ERR("Part 0x%x overlapping with data segment", p->id);
break;
}

if (CHECK_OVERLAP(load_addr, bytes_to_read, bss_start, bss_end)) {
rc = -PB_ERR_MEM;
rc = -PB_ERR;
LOG_ERR("Part 0x%x overlapping with bss", p->id);
break;
}

if (CHECK_OVERLAP(load_addr, bytes_to_read, code_start, code_end)) {
rc = -PB_ERR_MEM;
rc = -PB_ERR;
LOG_ERR("Part 0x%x overlapping with code segment", p->id);
break;
}

if (CHECK_OVERLAP(load_addr, bytes_to_read, no_init_start, no_init_end)) {
rc = -PB_ERR_MEM;
rc = -PB_ERR;
LOG_ERR("Part 0x%x overlapping with no_init segment", p->id);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/plat/imx6ul/rot_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int imx6ul_revoke_key(const struct rot_key *key)

if (rc != PB_OK) {
LOG_ERR("HAB is reporting errors, aborting");
return -PB_ERR_MEM;
return -PB_ERR_STATE;
}

rc = imx_ocotp_read(IMX6UL_FUSE_REVOKE_BANK,
Expand Down
2 changes: 1 addition & 1 deletion src/plat/imx6ul/slc_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int imx6ul_slc_set_configuration_locked(void)

if (!imx6ul_is_srk_fused()) {
LOG_ERR("SRK is empty, refusing to advance life cycle");
return -PB_ERR_MEM;
return -PB_ERR_STATE;
}

slc = imx6ul_slc_read_status();
Expand Down
2 changes: 1 addition & 1 deletion src/plat/imx8x/slc_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int imx8x_slc_set_configuration_locked(void)

if (!imx8x_is_srk_fused()) {
LOG_ERR("SRK is empty, refusing to advance life cycle");
return -PB_ERR_MEM;
return -PB_ERR_STATE;
}

sc_seco_chip_info(ipc, &lc, &monotonic, &uid_l, &uid_h);
Expand Down

0 comments on commit 9dc2055

Please sign in to comment.