* [PATCH 1/3] hab: bail out with error when SRK hash write fails
@ 2024-07-15 12:36 Sascha Hauer
2024-07-15 12:36 ` [PATCH 2/3] hab: ahab: cosmetic change Sascha Hauer
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Sascha Hauer @ 2024-07-15 12:36 UTC (permalink / raw)
To: Barebox List
When we fail to write fuses during writing the SRK hash, then bail
out with an error instead of silently ignoring it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/hab/hab.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/hab/hab.c b/drivers/hab/hab.c
index 28a091841a..288f440bd2 100644
--- a/drivers/hab/hab.c
+++ b/drivers/hab/hab.c
@@ -280,9 +280,11 @@ static int imx_ahab_write_srk_hash(const u8 *__newsrk, unsigned flags)
for (i = 0; i < 32 / sizeof(u32); i++) {
ret = ele_write_fuse(0x80 + i, newsrk[i], false, &resp);
- if (ret)
+ if (ret) {
pr_err("Writing fuse index 0x%02x failed with %d, response 0x%08x\n",
i, ret, resp);
+ return ret;
+ }
}
return 0;
--
2.39.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/3] hab: ahab: cosmetic change
2024-07-15 12:36 [PATCH 1/3] hab: bail out with error when SRK hash write fails Sascha Hauer
@ 2024-07-15 12:36 ` Sascha Hauer
2024-07-15 12:36 ` [PATCH 3/3] hab: ahab: use pr_* for printing Sascha Hauer
2024-07-16 7:03 ` [PATCH 1/3] hab: bail out with error when SRK hash write fails Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2024-07-15 12:36 UTC (permalink / raw)
To: Barebox List
We have the SRK_HASH_SIZE define, so use it instead of hardcoded 32.
Also, use sizeof(u32) instead of sizeof(uint32_t) as that is the type
we are operating on.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/hab/hab.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hab/hab.c b/drivers/hab/hab.c
index 288f440bd2..5701e5feb5 100644
--- a/drivers/hab/hab.c
+++ b/drivers/hab/hab.c
@@ -278,7 +278,7 @@ static int imx_ahab_write_srk_hash(const u8 *__newsrk, unsigned flags)
return -EPERM;
}
- for (i = 0; i < 32 / sizeof(u32); i++) {
+ for (i = 0; i < SRK_HASH_SIZE / sizeof(u32); i++) {
ret = ele_write_fuse(0x80 + i, newsrk[i], false, &resp);
if (ret) {
pr_err("Writing fuse index 0x%02x failed with %d, response 0x%08x\n",
@@ -296,7 +296,7 @@ static int imx_ahab_read_srk_hash(u8 *__srk)
u32 resp;
int ret, i;
- for (i = 0; i < SRK_HASH_SIZE / sizeof(uint32_t); i++) {
+ for (i = 0; i < SRK_HASH_SIZE / sizeof(u32); i++) {
ret = ele_read_common_fuse(0x80 + i, &srk[i], &resp);
if (ret < 0)
return ret;
--
2.39.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/3] hab: ahab: use pr_* for printing
2024-07-15 12:36 [PATCH 1/3] hab: bail out with error when SRK hash write fails Sascha Hauer
2024-07-15 12:36 ` [PATCH 2/3] hab: ahab: cosmetic change Sascha Hauer
@ 2024-07-15 12:36 ` Sascha Hauer
2024-07-16 7:03 ` [PATCH 1/3] hab: bail out with error when SRK hash write fails Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2024-07-15 12:36 UTC (permalink / raw)
To: Barebox List
Use pr_* functions to get the messages into the log.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/hab/hab.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hab/hab.c b/drivers/hab/hab.c
index 5701e5feb5..800f26f26c 100644
--- a/drivers/hab/hab.c
+++ b/drivers/hab/hab.c
@@ -333,11 +333,11 @@ static int imx_ahab_lockdown_device(unsigned flags)
ret = ele_forward_lifecycle(ELE_LIFECYCLE_OEM_CLOSED, NULL);
if (ret) {
- printf("failed to forward lifecycle to OEM closed\n");
+ pr_err("failed to forward lifecycle to OEM closed: %pe\n", ERR_PTR(ret));
return ret;
}
- printf("Change to OEM closed successfully\n");
+ pr_info("Change to OEM closed successfully\n");
return 0;
}
--
2.39.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] hab: bail out with error when SRK hash write fails
2024-07-15 12:36 [PATCH 1/3] hab: bail out with error when SRK hash write fails Sascha Hauer
2024-07-15 12:36 ` [PATCH 2/3] hab: ahab: cosmetic change Sascha Hauer
2024-07-15 12:36 ` [PATCH 3/3] hab: ahab: use pr_* for printing Sascha Hauer
@ 2024-07-16 7:03 ` Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2024-07-16 7:03 UTC (permalink / raw)
To: Barebox List, Sascha Hauer
On Mon, 15 Jul 2024 14:36:12 +0200, Sascha Hauer wrote:
> When we fail to write fuses during writing the SRK hash, then bail
> out with an error instead of silently ignoring it.
>
>
Applied, thanks!
[1/3] hab: bail out with error when SRK hash write fails
https://git.pengutronix.de/cgit/barebox/commit/?id=3bfc2d81e26d (link may not be stable)
[2/3] hab: ahab: cosmetic change
https://git.pengutronix.de/cgit/barebox/commit/?id=c09a4202ff9a (link may not be stable)
[3/3] hab: ahab: use pr_* for printing
https://git.pengutronix.de/cgit/barebox/commit/?id=4c1cd778d7a9 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-07-16 7:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-15 12:36 [PATCH 1/3] hab: bail out with error when SRK hash write fails Sascha Hauer
2024-07-15 12:36 ` [PATCH 2/3] hab: ahab: cosmetic change Sascha Hauer
2024-07-15 12:36 ` [PATCH 3/3] hab: ahab: use pr_* for printing Sascha Hauer
2024-07-16 7:03 ` [PATCH 1/3] hab: bail out with error when SRK hash write fails Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox