mod/scmi_power_capping: fix use of uninitialized domain config
Fixes a bug where `domain_ctx->config` was passed to the validation function
before being assigned. The correct behavior is to validate the `config`
parameter first, then assign it to `domain_ctx->config` only if valid.
This change updates `pcapping_core_domain_init()` to pass the received
`config` parameter to `pcapping_core_check_domain_configuration()`.
Assignment to `domain_ctx->config` is performed only after successful
validation.
A unit test has been added to ensure domain initialization fails when
invalid configuration values are provided, and that the domain context
remains uninitialized in such cases.
Signed-off-by:
Mohamed Omar Asaker <mohamed.omarasaker@arm.com>
Loading
Please register or sign in to comment