[<prev] [next>] [day] [month] [year] [list]
Message-id: <1478771558-1314-1-git-send-email-shailendra.v@samsung.com>
Date: Thu, 10 Nov 2016 15:22:38 +0530
From: Shailendra Verma <shailendra.v@...sung.com>
To: Jarod Wilson <jarod@...sonet.com>,
Mauro Carvalho Chehab <mchehab@....samsung.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-media@...r.kernel.org, devel@...verdev.osuosl.org,
Shailendra Verma <shailendra.v@...sung.com>,
Shailendra Verma <shailendra.capricorn@...il.com>
Cc: linux-kernel@...r.kernel.org, vidushi.koul@...sung.com
Subject: [PATCH 2/2] Staging: Media: Lirc - Improvement in code readability
From: "Shailendra Verma" <shailendra.v@...sung.com>
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@...sung.com>
---
drivers/staging/media/lirc/lirc_imon.c | 5 ++---
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 198a805..610d38c 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);
--
1.7.9.5
Powered by blists - more mailing lists