diff options
| -rw-r--r-- | drivers/char/virtio_console.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 48306bc733f7..86e9011325dc 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
| @@ -416,20 +416,16 @@ static ssize_t send_buf(struct port *port, void *in_buf, size_t in_count) | |||
| 416 | out_vq->vq_ops->kick(out_vq); | 416 | out_vq->vq_ops->kick(out_vq); |
| 417 | 417 | ||
| 418 | if (ret < 0) { | 418 | if (ret < 0) { |
| 419 | len = 0; | 419 | in_count = 0; |
| 420 | goto fail; | 420 | goto fail; |
| 421 | } | 421 | } |
| 422 | 422 | ||
| 423 | /* | 423 | /* Wait till the host acknowledges it pushed out the data we sent. */ |
| 424 | * Wait till the host acknowledges it pushed out the data we | ||
| 425 | * sent. Also ensure we return to userspace the number of | ||
| 426 | * bytes that were successfully consumed by the host. | ||
| 427 | */ | ||
| 428 | while (!out_vq->vq_ops->get_buf(out_vq, &len)) | 424 | while (!out_vq->vq_ops->get_buf(out_vq, &len)) |
| 429 | cpu_relax(); | 425 | cpu_relax(); |
| 430 | fail: | 426 | fail: |
| 431 | /* We're expected to return the amount of data we wrote */ | 427 | /* We're expected to return the amount of data we wrote */ |
| 432 | return len; | 428 | return in_count; |
| 433 | } | 429 | } |
| 434 | 430 | ||
| 435 | /* | 431 | /* |
