summaryrefslogtreecommitdiffstats
path: root/drivers/staging/lirc/lirc_parallel.c
diff options
context:
space:
mode:
authorJarod Wilson2011-01-17 20:02:00 +0100
committerMauro Carvalho Chehab2011-01-19 15:52:22 +0100
commit88914bdf8c677ebd7e797adac05e47303fd6ac77 (patch)
tree6ba8b683d9b19ee4d2d7aa0836b1f2cf7dc4d1f6 /drivers/staging/lirc/lirc_parallel.c
parent[media] hdpvr: reduce latency of i2c read/write w/recycled buffer (diff)
downloadkernel-qcow2-linux-88914bdf8c677ebd7e797adac05e47303fd6ac77.tar.gz
kernel-qcow2-linux-88914bdf8c677ebd7e797adac05e47303fd6ac77.tar.xz
kernel-qcow2-linux-88914bdf8c677ebd7e797adac05e47303fd6ac77.zip
[media] staging/lirc: fix mem leaks and ptr err usage
When the lirc drivers were converted over to using memdup_user, I mistakenly also removed corresponding calls to kfree. Add those back. I also screwed up on the allocation error check in lirc_serial, using if (PTR_ERR()) instead of if (IS_ERR()), which broke transmit. Reported-by: Jiri Fojtasek <jiri.fojtasek@hlohovec.net> Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/staging/lirc/lirc_parallel.c')
-rw-r--r--drivers/staging/lirc/lirc_parallel.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/staging/lirc/lirc_parallel.c b/drivers/staging/lirc/lirc_parallel.c
index dfd2c447e67d..3a9c09881b2b 100644
--- a/drivers/staging/lirc/lirc_parallel.c
+++ b/drivers/staging/lirc/lirc_parallel.c
@@ -376,6 +376,7 @@ static ssize_t lirc_write(struct file *filep, const char *buf, size_t n,
unsigned long flags;
int counttimer;
int *wbuf;
+ ssize_t ret;
if (!is_claimed)
return -EBUSY;
@@ -393,8 +394,10 @@ static ssize_t lirc_write(struct file *filep, const char *buf, size_t n,
if (timer == 0) {
/* try again if device is ready */
timer = init_lirc_timer();
- if (timer == 0)
- return -EIO;
+ if (timer == 0) {
+ ret = -EIO;
+ goto out;
+ }
}
/* adjust values from usecs */
@@ -420,7 +423,8 @@ static ssize_t lirc_write(struct file *filep, const char *buf, size_t n,
if (check_pselecd && (in(1) & LP_PSELECD)) {
lirc_off();
local_irq_restore(flags);
- return -EIO;
+ ret = -EIO;
+ goto out;
}
} while (counttimer < wbuf[i]);
i++;
@@ -436,7 +440,8 @@ static ssize_t lirc_write(struct file *filep, const char *buf, size_t n,
level = newlevel;
if (check_pselecd && (in(1) & LP_PSELECD)) {
local_irq_restore(flags);
- return -EIO;
+ ret = -EIO;
+ goto out;
}
} while (counttimer < wbuf[i]);
i++;
@@ -445,7 +450,11 @@ static ssize_t lirc_write(struct file *filep, const char *buf, size_t n,
#else
/* place code that handles write without external timer here */
#endif
- return n;
+ ret = n;
+out:
+ kfree(wbuf);
+
+ return ret;
}
static unsigned int lirc_poll(struct file *file, poll_table *wait)