Commit 30f88a42 authored by Shailendra Verma's avatar Shailendra Verma Committed by Mauro Carvalho Chehab

[media] staging: lirc: Improvement in code readability

There is no need to call kfree() if memdup_user() fails, as no memory
was allocated and the error in the error-valued pointer should be returned.
Signed-off-by: default avatarShailendra Verma <shailendra.v@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 2bfc04d6
...@@ -408,9 +408,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf, ...@@ -408,9 +408,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,
data_buf = memdup_user(buf, n_bytes); data_buf = memdup_user(buf, n_bytes);
if (IS_ERR(data_buf)) { if (IS_ERR(data_buf)) {
retval = PTR_ERR(data_buf); mutex_unlock(&context->ctx_lock);
data_buf = NULL; return PTR_ERR(data_buf);
goto exit;
} }
memcpy(context->tx.data_buf, data_buf, n_bytes); memcpy(context->tx.data_buf, data_buf, n_bytes);
......
...@@ -384,9 +384,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf, ...@@ -384,9 +384,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,
data_buf = memdup_user(buf, n_bytes); data_buf = memdup_user(buf, n_bytes);
if (IS_ERR(data_buf)) { if (IS_ERR(data_buf)) {
retval = PTR_ERR(data_buf); mutex_unlock(&context->ctx_lock);
data_buf = NULL; return PTR_ERR(data_buf);
goto exit;
} }
memcpy(context->tx.data_buf, data_buf, n_bytes); memcpy(context->tx.data_buf, data_buf, n_bytes);
......
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