All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw: fw_cfg: Improve error message when can't load splash file
@ 2018-11-01  6:02 Li Qiang
  2018-11-27  3:02 ` Li Qiang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Li Qiang @ 2018-11-01  6:02 UTC (permalink / raw)
  To: pbonzini, armbru, philmd, lersek; +Cc: qemu-devel, Li Qiang

read_splashfile() reports "failed to read splash file" without
further details. Get the details from g_file_get_contents(), and
include them in the error message. Also remove unnecessary 'res'
variable.

Signed-off-by: Li Qiang <liq3ea@gmail.com>
---
 hw/nvram/fw_cfg.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index 946f765..3fcfa35 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -68,15 +68,14 @@ static char *read_splashfile(char *filename, gsize *file_sizep,
                              int *file_typep)
 {
     GError *err = NULL;
-    gboolean res;
     gchar *content;
     int file_type;
     unsigned int filehead;
     int bmp_bpp;
 
-    res = g_file_get_contents(filename, &content, file_sizep, &err);
-    if (res == FALSE) {
-        error_report("failed to read splash file '%s'", filename);
+    if (!g_file_get_contents(filename, &content, file_sizep, &err)) {
+        error_report("failed to read splash file '%s': %s",
+                     filename, err->message);
         g_error_free(err);
         return NULL;
     }
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] hw: fw_cfg: Improve error message when can't load splash file
  2018-11-01  6:02 [Qemu-devel] [PATCH] hw: fw_cfg: Improve error message when can't load splash file Li Qiang
@ 2018-11-27  3:02 ` Li Qiang
  2018-11-27  6:44 ` Markus Armbruster
  2018-12-11 15:45 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 4+ messages in thread
From: Li Qiang @ 2018-11-27  3:02 UTC (permalink / raw)
  To: Paolo Bonzini, Markus Armbruster, philmd, Laszlo Ersek; +Cc: Qemu Developers

Hello Paolo, Philippe

Seems this patch has been lost...

I think Philippe can merge it for 4.0, right?
Also pls notice the following fw_cfg patchset.
-->https://lists.gnu.org/archive/html/qemu-devel/2018-11/msg04097.html

Thanks,
Li Qiang


Li Qiang <liq3ea@gmail.com> 于2018年11月1日周四 下午2:02写道:

> read_splashfile() reports "failed to read splash file" without
> further details. Get the details from g_file_get_contents(), and
> include them in the error message. Also remove unnecessary 'res'
> variable.
>
> Signed-off-by: Li Qiang <liq3ea@gmail.com>
> ---
>  hw/nvram/fw_cfg.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
> index 946f765..3fcfa35 100644
> --- a/hw/nvram/fw_cfg.c
> +++ b/hw/nvram/fw_cfg.c
> @@ -68,15 +68,14 @@ static char *read_splashfile(char *filename, gsize
> *file_sizep,
>                               int *file_typep)
>  {
>      GError *err = NULL;
> -    gboolean res;
>      gchar *content;
>      int file_type;
>      unsigned int filehead;
>      int bmp_bpp;
>
> -    res = g_file_get_contents(filename, &content, file_sizep, &err);
> -    if (res == FALSE) {
> -        error_report("failed to read splash file '%s'", filename);
> +    if (!g_file_get_contents(filename, &content, file_sizep, &err)) {
> +        error_report("failed to read splash file '%s': %s",
> +                     filename, err->message);
>          g_error_free(err);
>          return NULL;
>      }
> --
> 1.8.3.1
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] hw: fw_cfg: Improve error message when can't load splash file
  2018-11-01  6:02 [Qemu-devel] [PATCH] hw: fw_cfg: Improve error message when can't load splash file Li Qiang
  2018-11-27  3:02 ` Li Qiang
@ 2018-11-27  6:44 ` Markus Armbruster
  2018-12-11 15:45 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2018-11-27  6:44 UTC (permalink / raw)
  To: Li Qiang; +Cc: pbonzini, philmd, lersek, qemu-devel

Li Qiang <liq3ea@gmail.com> writes:

> read_splashfile() reports "failed to read splash file" without
> further details. Get the details from g_file_get_contents(), and
> include them in the error message. Also remove unnecessary 'res'
> variable.
>
> Signed-off-by: Li Qiang <liq3ea@gmail.com>
> ---
>  hw/nvram/fw_cfg.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
> index 946f765..3fcfa35 100644
> --- a/hw/nvram/fw_cfg.c
> +++ b/hw/nvram/fw_cfg.c
> @@ -68,15 +68,14 @@ static char *read_splashfile(char *filename, gsize *file_sizep,
>                               int *file_typep)
>  {
>      GError *err = NULL;
> -    gboolean res;
>      gchar *content;
>      int file_type;
>      unsigned int filehead;
>      int bmp_bpp;
>  
> -    res = g_file_get_contents(filename, &content, file_sizep, &err);
> -    if (res == FALSE) {
> -        error_report("failed to read splash file '%s'", filename);
> +    if (!g_file_get_contents(filename, &content, file_sizep, &err)) {
> +        error_report("failed to read splash file '%s': %s",
> +                     filename, err->message);
>          g_error_free(err);
>          return NULL;
>      }

Reviewed-by: Markus Armbruster <armbru@redhat.com>

Philippe, I assume you'll take this.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] hw: fw_cfg: Improve error message when can't load splash file
  2018-11-01  6:02 [Qemu-devel] [PATCH] hw: fw_cfg: Improve error message when can't load splash file Li Qiang
  2018-11-27  3:02 ` Li Qiang
  2018-11-27  6:44 ` Markus Armbruster
@ 2018-12-11 15:45 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-12-11 15:45 UTC (permalink / raw)
  To: Li Qiang, pbonzini, armbru, lersek; +Cc: qemu-devel

On 11/1/18 7:02 AM, Li Qiang wrote:
> read_splashfile() reports "failed to read splash file" without
> further details. Get the details from g_file_get_contents(), and
> include them in the error message. Also remove unnecessary 'res'
> variable.
> 
> Signed-off-by: Li Qiang <liq3ea@gmail.com>
> ---
>  hw/nvram/fw_cfg.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
> index 946f765..3fcfa35 100644
> --- a/hw/nvram/fw_cfg.c
> +++ b/hw/nvram/fw_cfg.c
> @@ -68,15 +68,14 @@ static char *read_splashfile(char *filename, gsize *file_sizep,
>                               int *file_typep)
>  {
>      GError *err = NULL;
> -    gboolean res;
>      gchar *content;
>      int file_type;
>      unsigned int filehead;
>      int bmp_bpp;
>  
> -    res = g_file_get_contents(filename, &content, file_sizep, &err);
> -    if (res == FALSE) {
> -        error_report("failed to read splash file '%s'", filename);
> +    if (!g_file_get_contents(filename, &content, file_sizep, &err)) {
> +        error_report("failed to read splash file '%s': %s",
> +                     filename, err->message);
>          g_error_free(err);
>          return NULL;
>      }
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

and queued, thanks!

Phil.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-12-11 15:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-01  6:02 [Qemu-devel] [PATCH] hw: fw_cfg: Improve error message when can't load splash file Li Qiang
2018-11-27  3:02 ` Li Qiang
2018-11-27  6:44 ` Markus Armbruster
2018-12-11 15:45 ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.