Patchwork [24/41] buffered_file: callers of buffered_flush() already check for errors

login
register
mail settings
Submitter Juan Quintela
Date Sept. 21, 2012, 8:47 a.m.
Message ID <1348217255-22441-25-git-send-email-quintela@redhat.com>
Download mbox | patch
Permalink /patch/185671/
State New
Headers show

Comments

Juan Quintela - Sept. 21, 2012, 8:47 a.m.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 buffered_file.c | 7 -------
 1 file changed, 7 deletions(-)
Paolo Bonzini - Sept. 21, 2012, 12:39 p.m.
Il 21/09/2012 10:47, Juan Quintela ha scritto:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  buffered_file.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/buffered_file.c b/buffered_file.c
> index 43e68b6..747d672 100644
> --- a/buffered_file.c
> +++ b/buffered_file.c
> @@ -61,13 +61,6 @@ static void buffered_append(QEMUFileBuffered *s,
>  static void buffered_flush(QEMUFileBuffered *s)
>  {
>      size_t offset = 0;
> -    int error;
> -
> -    error = qemu_file_get_error(s->file);
> -    if (error != 0) {
> -        DPRINTF("flush when error, bailing: %s\n", strerror(-error));
> -        return;
> -    }
> 
>      DPRINTF("flushing %zu byte(s) of data\n", s->buffer_size);
> 

Right, they do so _before_ checking buffered_flush which matches the
code you are removing here.

Perhaps an assertion would be better, but still:

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Patch

diff --git a/buffered_file.c b/buffered_file.c
index 43e68b6..747d672 100644
--- a/buffered_file.c
+++ b/buffered_file.c
@@ -61,13 +61,6 @@  static void buffered_append(QEMUFileBuffered *s,
 static void buffered_flush(QEMUFileBuffered *s)
 {
     size_t offset = 0;
-    int error;
-
-    error = qemu_file_get_error(s->file);
-    if (error != 0) {
-        DPRINTF("flush when error, bailing: %s\n", strerror(-error));
-        return;
-    }

     DPRINTF("flushing %zu byte(s) of data\n", s->buffer_size);