[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: Shailendra Verma <shailendra.v@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
Shailendra Verma 2016-11-10 07:52:38 -02:00 committed by Mauro Carvalho Chehab
parent 2bfc04d64d
commit 30f88a42b6
2 changed files with 4 additions and 6 deletions

View File

@ -408,9 +408,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,
data_buf = memdup_user(buf, n_bytes);
if (IS_ERR(data_buf)) {
retval = PTR_ERR(data_buf);
data_buf = NULL;
goto exit;
mutex_unlock(&context->ctx_lock);
return PTR_ERR(data_buf);
}
memcpy(context->tx.data_buf, data_buf, n_bytes);

View File

@ -384,9 +384,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,
data_buf = memdup_user(buf, n_bytes);
if (IS_ERR(data_buf)) {
retval = PTR_ERR(data_buf);
data_buf = NULL;
goto exit;
mutex_unlock(&context->ctx_lock);
return PTR_ERR(data_buf);
}
memcpy(context->tx.data_buf, data_buf, n_bytes);