firmware: zynqmp: Handle errors from ipi_req properly
authorMichal Simek <michal.simek@xilinx.com>
Fri, 15 Oct 2021 14:57:38 +0000 (16:57 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 21 Oct 2021 06:54:49 +0000 (08:54 +0200)
There are multiple errors what can happen in ipi_req but they are not
propagated properly. That's why propage all error properly.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Adrian Fiergolski <Adrian.Fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/7ac4f3b2104f04c72d287c46d1ccbce20f138fd4.1634309856.git.michal.simek@xilinx.com
drivers/firmware/firmware-zynqmp.c

index d4dc856..7e0acc5 100644 (file)
@@ -164,6 +164,7 @@ int __maybe_unused xilinx_pm_request(u32 api_id, u32 arg0, u32 arg1, u32 arg2,
                 * firmware API is limited by the SMC call size
                 */
                u32 regs[] = {api_id, arg0, arg1, arg2, arg3};
+               int ret;
 
                if (api_id == PM_FPGA_LOAD) {
                        /* Swap addr_hi/low because of incompatibility */
@@ -173,7 +174,10 @@ int __maybe_unused xilinx_pm_request(u32 api_id, u32 arg0, u32 arg1, u32 arg2,
                        regs[2] = temp;
                }
 
-               ipi_req(regs, PAYLOAD_ARG_CNT, ret_payload, PAYLOAD_ARG_CNT);
+               ret = ipi_req(regs, PAYLOAD_ARG_CNT, ret_payload,
+                             PAYLOAD_ARG_CNT);
+               if (ret)
+                       return ret;
 #else
                return -EPERM;
 #endif