diff options
Diffstat (limited to 'drivers/misc/mei/iorw.c')
-rw-r--r-- | drivers/misc/mei/iorw.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/misc/mei/iorw.c b/drivers/misc/mei/iorw.c index fcba98eb892e..20652e140c43 100644 --- a/drivers/misc/mei/iorw.c +++ b/drivers/misc/mei/iorw.c | |||
@@ -346,9 +346,9 @@ int amthi_read(struct mei_device *dev, struct file *file, | |||
346 | } | 346 | } |
347 | } | 347 | } |
348 | /* if the whole message will fit remove it from the list */ | 348 | /* if the whole message will fit remove it from the list */ |
349 | if (cb->information >= *offset && length >= (cb->information - *offset)) | 349 | if (cb->buf_idx >= *offset && length >= (cb->buf_idx - *offset)) |
350 | list_del(&cb->cb_list); | 350 | list_del(&cb->cb_list); |
351 | else if (cb->information > 0 && cb->information <= *offset) { | 351 | else if (cb->buf_idx > 0 && cb->buf_idx <= *offset) { |
352 | /* end of the message has been reached */ | 352 | /* end of the message has been reached */ |
353 | list_del(&cb->cb_list); | 353 | list_del(&cb->cb_list); |
354 | rets = 0; | 354 | rets = 0; |
@@ -360,18 +360,17 @@ int amthi_read(struct mei_device *dev, struct file *file, | |||
360 | 360 | ||
361 | dev_dbg(&dev->pdev->dev, "amthi cb->response_buffer size - %d\n", | 361 | dev_dbg(&dev->pdev->dev, "amthi cb->response_buffer size - %d\n", |
362 | cb->response_buffer.size); | 362 | cb->response_buffer.size); |
363 | dev_dbg(&dev->pdev->dev, "amthi cb->information - %lu\n", | 363 | dev_dbg(&dev->pdev->dev, "amthi cb->buf_idx - %lu\n", cb->buf_idx); |
364 | cb->information); | ||
365 | 364 | ||
366 | /* length is being turncated to PAGE_SIZE, however, | 365 | /* length is being turncated to PAGE_SIZE, however, |
367 | * the information may be longer */ | 366 | * the buf_idx may point beyond */ |
368 | length = min_t(size_t, length, (cb->information - *offset)); | 367 | length = min_t(size_t, length, (cb->buf_idx - *offset)); |
369 | 368 | ||
370 | if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length)) | 369 | if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length)) |
371 | rets = -EFAULT; | 370 | rets = -EFAULT; |
372 | else { | 371 | else { |
373 | rets = length; | 372 | rets = length; |
374 | if ((*offset + length) < cb->information) { | 373 | if ((*offset + length) < cb->buf_idx) { |
375 | *offset += length; | 374 | *offset += length; |
376 | goto out; | 375 | goto out; |
377 | } | 376 | } |
@@ -432,8 +431,8 @@ int mei_start_read(struct mei_device *dev, struct mei_cl *cl) | |||
432 | } | 431 | } |
433 | dev_dbg(&dev->pdev->dev, "allocation call back data success.\n"); | 432 | dev_dbg(&dev->pdev->dev, "allocation call back data success.\n"); |
434 | cb->major_file_operations = MEI_READ; | 433 | cb->major_file_operations = MEI_READ; |
435 | /* make sure information is zero before we start */ | 434 | /* make sure buffer index is zero before we start */ |
436 | cb->information = 0; | 435 | cb->buf_idx = 0; |
437 | cb->file_private = (void *) cl; | 436 | cb->file_private = (void *) cl; |
438 | cl->read_cb = cb; | 437 | cl->read_cb = cb; |
439 | if (dev->mei_host_buffer_is_empty) { | 438 | if (dev->mei_host_buffer_is_empty) { |