summaryrefslogtreecommitdiff
path: root/drivers/soc/qcom/smcinvoke.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/soc/qcom/smcinvoke.c')
-rw-r--r--drivers/soc/qcom/smcinvoke.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/soc/qcom/smcinvoke.c b/drivers/soc/qcom/smcinvoke.c
index 99ae24735f05..f69ff47ae0f7 100644
--- a/drivers/soc/qcom/smcinvoke.c
+++ b/drivers/soc/qcom/smcinvoke.c
@@ -429,10 +429,17 @@ long smcinvoke_ioctl(struct file *filp, unsigned cmd, unsigned long arg)
if (ret)
goto out;
- ret = marshal_out(in_msg, inmsg_size, &req, args_buf);
+ /*
+ * if invoke op results in an err, no need to marshal_out and
+ * copy args buf to user space
+ */
+ if (!req.result) {
+ ret = marshal_out(in_msg, inmsg_size, &req, args_buf);
- ret |= copy_to_user((void __user *)(uintptr_t)(req.args),
+ ret |= copy_to_user(
+ (void __user *)(uintptr_t)(req.args),
args_buf, nr_args * req.argsize);
+ }
ret |= copy_to_user((void __user *)arg, &req, sizeof(req));
if (ret)
goto out;