Page MenuHomePhabricator

Low level return type checked during init
Open, Needs TriagePublic

Description

Looking at - https://git.trustedfirmware.org/trusted-firmware-m.git/tree/app/main_ns.c#n90

tfm_ns_wait_for_s_cpu_ready() -> tfm_platform_ns_wait_for_s_cpu_ready() return a PLATFORM_MAILBOX_SUCCESS which seems to be very low level code, shouldn't it be TFM_SUCCESS ?

There may be some platforms other than PSoC6, which doesn't require tfm_ns_wait_for_s_cpu_ready() implementation. PLATFORM_MAILBOX_SUCCESS is a low-level error code and should be replaced by TFM_SUCCESS.

Event Timeline

Yes, lower level error codes can vary widely and applications won't know which particular one to check for. Error codes at the same level of abstraction as this API should be used, like TFM_SUCCESS.

jainvikas8 updated the task description. (Show Details)Feb 7 2020, 11:48 AM
jainvikas8 updated the task description. (Show Details)

Thx Vikas.
I add @chrisb to take a look since he is the designer. :)

I agree, it definitely shouldn't propagate that MAILBOX status.
Looks like the header file says that it returns 0 on success. We should probably make it clear which zero that is :-)