]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] staging: lirc: Improvement in code readability
authorShailendra Verma <shailendra.v@samsung.com>
Thu, 10 Nov 2016 09:52:38 +0000 (07:52 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 22 Nov 2016 14:21:25 +0000 (12:21 -0200)
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>
drivers/staging/media/lirc/lirc_imon.c
drivers/staging/media/lirc/lirc_sasem.c

index 00e00b0be275a6b1a7329e612e99580f4cf024a8..1e650fba4a92640ed5c00dd74b0daa8f9625a549 100644 (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);
index 4678ae10b0300fb4ac27e90ebb6e7bc24ab3826c..4fd810bc46dee071388eed4b8773c7d7428c360f 100644 (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);