linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Peng Fan <peng.fan@nxp.com>,
	Etienne Carriere <etienne.carriere@linaro.org>,
	Sudeep Holla <sudeep.holla@arm.com>
Subject: [PATCH] firmware: arm_scmi: Fix return error code in smc_send_message
Date: Fri, 17 Apr 2020 11:32:32 +0100	[thread overview]
Message-ID: <20200417103232.6896-1-sudeep.holla@arm.com> (raw)

SMCCC can return one of the 2 return error code here: NOT_SUPPORTED(-1)
and INVALID_PARAMETER(-3). Map them to appropriate Linux error codes
namely -EOPNOTSUPP and -EINVAL respectively. -EINVAL is also returned
for any other return values.

Cc: Peng Fan <peng.fan@nxp.com>
Reported-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/firmware/arm_scmi/smc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/arm_scmi/smc.c b/drivers/firmware/arm_scmi/smc.c
index 833e793b5391..a8b5ecb8927a 100644
--- a/drivers/firmware/arm_scmi/smc.c
+++ b/drivers/firmware/arm_scmi/smc.c
@@ -114,7 +114,11 @@ static int smc_send_message(struct scmi_chan_info *cinfo,
 
 	mutex_unlock(&scmi_info->shmem_lock);
 
-	return res.a0;
+	if (res.a0 == SMCCC_RET_NOT_SUPPORTED)
+		return -EOPNOTSUPP;
+	else if (res.a0)
+		return -EINVAL;
+	return 0;
 }
 
 static void smc_fetch_response(struct scmi_chan_info *cinfo,
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2020-04-17 10:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-17 10:32 Sudeep Holla [this message]
2020-04-18  9:02 ` [PATCH] firmware: arm_scmi: Fix return error code in smc_send_message Peng Fan
2020-04-19 10:04 ` Etienne Carriere
2020-04-20 15:35   ` Sudeep Holla
2020-04-20 16:25     ` Etienne Carriere
2020-04-20 16:52       ` Sudeep Holla
2020-04-20 18:13 ` Sudeep Holla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200417103232.6896-1-sudeep.holla@arm.com \
    --to=sudeep.holla@arm.com \
    --cc=etienne.carriere@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=peng.fan@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).