fw_cfg: print error message when reading splashfile failed
PATCH 1/1 fw_cfg: print error message when reading splashfile failed
Also remove unnecessary 'res' variable.
--- hw/nvram/fw_cfg.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
hw/nvram/fw_cfg.c +3 -4
@@ -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 ; }
Signature · 1 line
1.8.3.1
Quoted 21 lines · Li Qiang
Also remove unnecessary 'res' variable.
Signed-off-by Li Qiang <[email protected]>--- hw/nvram/fw_cfg.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)hw/nvram/fw_cfg.c +0
-1@@ -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;
hw/nvram/fw_cfg.c static char *read_splashfile(char *filename, gsize *file_sizep, · line 81
Quoted 10 lines
hw/nvram/fw_cfg.c +3
-3- 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 ; }
Seems to be OK, according to
<https://developer.gnome.org/glib/stable/glib-Error-Reporting.html#glib-Error-Reporting.description>.
Quoted 16 lines · Li Qiang
Also remove unnecessary 'res' variable.
Signed-off-by Li Qiang <[email protected]>--- hw/nvram/fw_cfg.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)hw/nvram/fw_cfg.c +0
-1@@ -68,15 +68,14 @@ static char *read_splashfile(char *filename, gsize *file_sizep, int *file_typep) {GError *err =NULL ; -gboolean res;
hw/nvram/fw_cfg.c static char *read_splashfile(char *filename, gsize *file_sizep, · line 77
Quoted 10 lines
hw/nvram/fw_cfg.c +2
-3gchar *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",
Can you use a column like the rest of the codebase?
i.e.: "failed to read splash file '%s': %s"
The maintainer taking this patch can do this minor change, so:
Quoted 5 lines
hw/nvram/fw_cfg.c +1
-0+ filename, err->message);g_error_free (err);return NULL ; }
Quoted 30 lines · Philippe Mathieu-Daudé
Quoted 16 lines · Li Qiang
Also remove unnecessary 'res' variable.
Signed-off-by Li Qiang <[email protected]>--- hw/nvram/fw_cfg.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)hw/nvram/fw_cfg.c +0
-1@@ -68,15 +68,14 @@ static char *read_splashfile(char *filename, gsize *file_sizep, int *file_typep) {GError *err =NULL ; -gboolean res;hw/nvram/fw_cfg.c static char *read_splashfile(char *filename, gsize *file_sizep, · line 78
Quoted 10 lines
hw/nvram/fw_cfg.c +2
-2gchar *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",Can you use a column like the rest of the codebase?
Quoted 1 line
i.e.: "failed to read splash file '%s': %s"
Yes, please.
Also, my remark on your "[PATCH] vl.c: print error message if loading fw_cfg file failed" applies to this patch as well. Please improve the commit message.
Quoted 8 lines
The maintainer taking this patch can do this minor change, so:
Reviewed-by Philippe Mathieu-Daudé <[email protected]>Quoted 5 lines
hw/nvram/fw_cfg.c +1
-0+ filename, err->message);g_error_free (err);return NULL ; }
Hello all,
I have sent out another patch.
As the email's subject and commit message changed,
I'm not sure is it suitable to add Philippe and Laszlo's R-b tag.
Thanks,
Li Qiang
Quoted 50 lines · Markus Armbruster <[email protected]> 于2018年10月31日周三 下午11:36写道:
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Li Qiang
Also remove unnecessary 'res' variable.
Signed-off-by Li Qiang <[email protected]>--- hw/nvram/fw_cfg.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)Quoted 5 lines
hw/nvram/fw_cfg.c static char *read_splashfile(char *filename, gsize
Quoted 5 lines
hw/nvram/fw_cfg.c +0
-0@@ -68,15 +68,14 @@ static char *read_splashfile(char *filename, gsize
*file_sizep,Quoted 15 lines
Quoted 4 lines
hw/nvram/fw_cfg.c +0
-1int *file_typep) {GError *err =NULL ; -gboolean res;hw/nvram/fw_cfg.c static char *read_splashfile(char *filename, gsize *file_sizep, · line 77
Quoted 10 lines
hw/nvram/fw_cfg.c +2
-2gchar *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",Quoted 3 lines
Can you use a column like the rest of the codebase?
i.e.: "failed to read splash file '%s': %s"
Yes, please.
Also, my remark on your "[PATCH]
vl.c: print error message if loadingfw_cfgfile failed" applies to this patch as well. Please improve the commit message.Quoted 8 lines
The maintainer taking this patch can do this minor change, so:
Reviewed-by Philippe Mathieu-Daudé <[email protected]>Quoted 5 lines
hw/nvram/fw_cfg.c +1
-0+ filename, err->message);g_error_free (err);return NULL ; }