aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/main.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2015-02-10 03:39:42 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-01 22:37:00 -0500
commit5db7514d9333c920791538c850cfb9dbd19025f7 (patch)
tree7dea99b1500378cf33b3fb1bab7e1297c150f810 /drivers/misc/mei/main.c
parent331e4187017e5dc12fddfcca3f8041e5610ea23b (diff)
mei: use only one buffer in callback
The callback structure is used exclusively for reading or writing therefore there is no reason to hold both response and request buffers in the callback structure Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/main.c')
-rw-r--r--drivers/misc/mei/main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index 9d1a8cba81c9..1d44d110ed94 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -264,7 +264,7 @@ copy_buffer:
264 } 264 }
265 265
266 dev_dbg(dev->dev, "buf.size = %d buf.idx= %ld\n", 266 dev_dbg(dev->dev, "buf.size = %d buf.idx= %ld\n",
267 cb->response_buffer.size, cb->buf_idx); 267 cb->buf.size, cb->buf_idx);
268 if (length == 0 || ubuf == NULL || *offset > cb->buf_idx) { 268 if (length == 0 || ubuf == NULL || *offset > cb->buf_idx) {
269 rets = -EMSGSIZE; 269 rets = -EMSGSIZE;
270 goto free; 270 goto free;
@@ -274,7 +274,7 @@ copy_buffer:
274 * however buf_idx may point beyond that */ 274 * however buf_idx may point beyond that */
275 length = min_t(size_t, length, cb->buf_idx - *offset); 275 length = min_t(size_t, length, cb->buf_idx - *offset);
276 276
277 if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length)) { 277 if (copy_to_user(ubuf, cb->buf.data + *offset, length)) {
278 dev_dbg(dev->dev, "failed to copy data to userland\n"); 278 dev_dbg(dev->dev, "failed to copy data to userland\n");
279 rets = -EFAULT; 279 rets = -EFAULT;
280 goto free; 280 goto free;
@@ -389,11 +389,11 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
389 rets = -ENOMEM; 389 rets = -ENOMEM;
390 goto out; 390 goto out;
391 } 391 }
392 rets = mei_io_cb_alloc_req_buf(write_cb, length); 392 rets = mei_io_cb_alloc_buf(write_cb, length);
393 if (rets) 393 if (rets)
394 goto out; 394 goto out;
395 395
396 rets = copy_from_user(write_cb->request_buffer.data, ubuf, length); 396 rets = copy_from_user(write_cb->buf.data, ubuf, length);
397 if (rets) { 397 if (rets) {
398 dev_dbg(dev->dev, "failed to copy data from userland\n"); 398 dev_dbg(dev->dev, "failed to copy data from userland\n");
399 rets = -EFAULT; 399 rets = -EFAULT;