diff options
author | Shailendra Verma <shailendra.v@samsung.com> | 2016-11-10 07:52:38 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-11-22 12:21:25 -0200 |
commit | 30f88a42b65858d777b8dfb40bb222fa31d5f0d9 (patch) | |
tree | b9e47d7e3cd9684829b2a6c243fc3cf7e1268e4c /drivers/staging | |
parent | 2bfc04d64db66fa62021a988740e8028f018b9c3 (diff) | |
download | op-kernel-dev-30f88a42b65858d777b8dfb40bb222fa31d5f0d9.zip op-kernel-dev-30f88a42b65858d777b8dfb40bb222fa31d5f0d9.tar.gz |
[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.c | 5 | ||||
-rw-r--r-- | drivers/staging/media/lirc/lirc_sasem.c | 5 |
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 00e00b0..1e650fb 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 4678ae1..4fd810b 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); |