summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorShailendra Verma2016-11-10 10:52:38 +0100
committerMauro Carvalho Chehab2016-11-22 15:21:25 +0100
commit30f88a42b65858d777b8dfb40bb222fa31d5f0d9 (patch)
treeb9e47d7e3cd9684829b2a6c243fc3cf7e1268e4c /drivers/staging
parent[media] sanyo decoder: address was being truncated (diff)
downloadkernel-qcow2-linux-30f88a42b65858d777b8dfb40bb222fa31d5f0d9.tar.gz
kernel-qcow2-linux-30f88a42b65858d777b8dfb40bb222fa31d5f0d9.tar.xz
kernel-qcow2-linux-30f88a42b65858d777b8dfb40bb222fa31d5f0d9.zip
[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>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/media/lirc/lirc_imon.c5
-rw-r--r--drivers/staging/media/lirc/lirc_sasem.c5
2 files changed, 4 insertions, 6 deletions
diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c
index 00e00b0be275..1e650fba4a92 100644
--- a/drivers/staging/media/lirc/lirc_imon.c
+++ b/drivers/staging/media/lirc/lirc_imon.c
@@ -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);
diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c
index 4678ae10b030..4fd810bc46de 100644
--- a/drivers/staging/media/lirc/lirc_sasem.c
+++ b/drivers/staging/media/lirc/lirc_sasem.c
@@ -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);