Commit 17f5f28f authored by Lee Jones's avatar Lee Jones Committed by Jassi Brar

mailbox: mailbox-test: Use more consistent format for calling copy_from_user()

While we're at it, ensure copy-to location is NULL'ed in the error path.
Suggested-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
Signed-off-by: default avatarJassi Brar <jaswinder.singh@linaro.org>
parent a61b37ea
...@@ -46,7 +46,6 @@ static ssize_t mbox_test_signal_write(struct file *filp, ...@@ -46,7 +46,6 @@ static ssize_t mbox_test_signal_write(struct file *filp,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct mbox_test_device *tdev = filp->private_data; struct mbox_test_device *tdev = filp->private_data;
int ret;
if (!tdev->tx_channel) { if (!tdev->tx_channel) {
dev_err(tdev->dev, "Channel cannot do Tx\n"); dev_err(tdev->dev, "Channel cannot do Tx\n");
...@@ -64,13 +63,13 @@ static ssize_t mbox_test_signal_write(struct file *filp, ...@@ -64,13 +63,13 @@ static ssize_t mbox_test_signal_write(struct file *filp,
if (!tdev->signal) if (!tdev->signal)
return -ENOMEM; return -ENOMEM;
ret = copy_from_user(tdev->signal, userbuf, count); if (copy_from_user(tdev->signal, userbuf, count)) {
if (ret) {
kfree(tdev->signal); kfree(tdev->signal);
tdev->signal = NULL;
return -EFAULT; return -EFAULT;
} }
return ret < 0 ? ret : count; return count;
} }
static const struct file_operations mbox_test_signal_ops = { static const struct file_operations mbox_test_signal_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment