]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
fix(zynqmp): check return status of pm_get_api_version
authorNaman Patel <naman.patel@amd.com>
Tue, 22 Nov 2022 13:01:37 +0000 (05:01 -0800)
committerNaman Patel <naman.patel@amd.com>
Thu, 24 Nov 2022 13:30:23 +0000 (05:30 -0800)
MISRA Violation: MISRA C-2012 Rule 17.7
- Check the return status of function pm_get_api_version
and return error in case of failure.

Signed-off-by: Naman Patel <naman.patel@amd.com>
Change-Id: I69fb000c04f22996da7965a09a1797c7bfaad252

plat/xilinx/zynqmp/pm_service/pm_svc_main.c

index 03fa3163245d81678a3fd422801a99e43500d88c..b45ce6c76051b0048eccc07ed7b7c563c632d55e 100644 (file)
@@ -207,10 +207,16 @@ err:
  */
 int32_t pm_setup(void)
 {
+       enum pm_ret_status err;
 
        pm_ipi_init(primary_proc);
 
-       pm_get_api_version(&pm_ctx.api_version);
+       err = pm_get_api_version(&pm_ctx.api_version);
+       if (err != PM_RET_SUCCESS) {
+               ERROR("BL31: Failed to read Platform Management API version. "
+                     "Return: %d\n", err);
+               return -EINVAL;
+       }
        if (pm_ctx.api_version < PM_VERSION) {
                ERROR("BL31: Platform Management API version error. Expected: "
                      "v%d.%d - Found: v%d.%d\n", PM_VERSION_MAJOR,