aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2010-12-08 10:57:40 +0000
committerAlan Cox <alan@linux.intel.com>2010-12-08 10:57:40 +0000
commitf7ac974ca1405b281f3626e4c7e0b60b6b16c8c5 (patch)
treee573d78d926f8fc01696fae2e8bd1adf7f900563
parent5aefe61e52f2350d8449a4fdb6b6d5147caa31f2 (diff)
downloadmrst-s0i3-test-f7ac974ca1405b281f3626e4c7e0b60b6b16c8c5.tar.gz
mrst-s0i3-test-f7ac974ca1405b281f3626e4c7e0b60b6b16c8c5.tar.xz
mrst-s0i3-test-f7ac974ca1405b281f3626e4c7e0b60b6b16c8c5.zip
pti: fix user copy size
8K is 8192 bytes, plus fix reporting
-rw-r--r--drivers/misc/pti.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/misc/pti.c b/drivers/misc/pti.c
index 42e9f05dd51..807a42889f3 100644
--- a/drivers/misc/pti.c
+++ b/drivers/misc/pti.c
@@ -49,7 +49,7 @@
#define CONSOLE_ID 73 /* console master ID address */
#define OS_BASE_ID 74 /* base OS master ID address */
#define APP_BASE_ID 80 /* base App master ID address */
-#define USER_COPY_SIZE 8196 /* 8Kb buffer to copy data from user space */
+#define USER_COPY_SIZE 8192 /* 8Kb buffer to copy data from user space */
struct pti_tty {
struct masterchannel *mc;
@@ -412,8 +412,6 @@ static int pti_tty_driver_open(struct tty_struct *tty, struct file *filp)
struct masterchannel *mc;
int ret = 0;
- pr_debug("%s %s(%d): Called.\n", __FILE__, __func__, __LINE__);
-
/*
we actually want to allocate a new channel per open, per
system arch. HW gives more than plenty channels for a single
@@ -424,6 +422,8 @@ static int pti_tty_driver_open(struct tty_struct *tty, struct file *filp)
ret = tty_port_open(&drv_data->port, tty, filp);
pti_tty_data = tty->driver_data;
mc = mipi_request_masterchannel(0);
+ if (mc == 0)
+ return -EBUSY;
pti_tty_data->mc = mc;
return ret;
@@ -602,7 +602,7 @@ ssize_t pti_char_write(struct file *filp, const char *data, size_t len,
if (copy_from_user(kbuf, tmp, size)) {
kfree(kbuf);
- return -EFAULT;
+ return n ? n : -EFAULT;
}
pr_debug("%s(%d): writing %u bytes\n", __func__, __LINE__,