From f7199cf489027ae38a9a82312d13025f7aefa0b8 Mon Sep 17 00:00:00 2001 From: Sudeep Holla Date: Fri, 17 Apr 2020 11:32:32 +0100 Subject: [PATCH] firmware: arm_scmi: Fix return error code in smc_send_message SMCCC can return NOT_SUPPORTED(-1). Map it to appropriate Linux error codes namely -EOPNOTSUPP. Link: https://lore.kernel.org/r/20200417103232.6896-1-sudeep.holla@arm.com Reported-and-Tested-by:: Etienne Carriere Reviewed-by: Etienne Carriere Reviewed-by: Peng Fan Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/smc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/arm_scmi/smc.c b/drivers/firmware/arm_scmi/smc.c index 833e793b5391..49bc4b0e8428 100644 --- a/drivers/firmware/arm_scmi/smc.c +++ b/drivers/firmware/arm_scmi/smc.c @@ -114,7 +114,10 @@ static int smc_send_message(struct scmi_chan_info *cinfo, mutex_unlock(&scmi_info->shmem_lock); - return res.a0; + /* Only SMCCC_RET_NOT_SUPPORTED is valid error code */ + if (res.a0) + return -EOPNOTSUPP; + return 0; } static void smc_fetch_response(struct scmi_chan_info *cinfo,