All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] device_tree.c: redirect load_device_tree err message to stderr
@ 2014-08-25  8:44 john.liuli
  2014-08-26  2:47 ` Peter Crosthwaite
  2014-08-26 11:44 ` Markus Armbruster
  0 siblings, 2 replies; 4+ messages in thread
From: john.liuli @ 2014-08-25  8:44 UTC (permalink / raw)
  To: peter.crosthwaite, agraf; +Cc: Li Liu, qemu-devel

From: Li Liu <john.liuli@huawei.com>

Signed-off-by: Li Liu <john.liuli@huawei.com>
---
 device_tree.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/device_tree.c b/device_tree.c
index ca83504..ccdb039 100644
--- a/device_tree.c
+++ b/device_tree.c
@@ -79,7 +79,7 @@ void *load_device_tree(const char *filename_path, int *sizep)
     *sizep = 0;
     dt_size = get_image_size(filename_path);
     if (dt_size < 0) {
-        printf("Unable to get size of device tree file '%s'\n",
+        fprintf(stderr, "Unable to get size of device tree file '%s'\n",
             filename_path);
         goto fail;
     }
@@ -92,20 +92,20 @@ void *load_device_tree(const char *filename_path, int *sizep)
 
     dt_file_load_size = load_image(filename_path, fdt);
     if (dt_file_load_size < 0) {
-        printf("Unable to open device tree file '%s'\n",
+        fprintf(stderr, "Unable to open device tree file '%s'\n",
                filename_path);
         goto fail;
     }
 
     ret = fdt_open_into(fdt, fdt, dt_size);
     if (ret) {
-        printf("Unable to copy device tree in memory\n");
+        fprintf(stderr, "Unable to copy device tree in memory\n");
         goto fail;
     }
 
     /* Check sanity of device tree */
     if (fdt_check_header(fdt)) {
-        printf ("Device tree file loaded into memory is invalid: %s\n",
+        fprintf(stderr, "Device tree file loaded into memory is invalid: %s\n",
             filename_path);
         goto fail;
     }
-- 
1.7.9.5

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

* Re: [Qemu-devel] [PATCH] device_tree.c: redirect load_device_tree err message to stderr
  2014-08-25  8:44 [Qemu-devel] [PATCH] device_tree.c: redirect load_device_tree err message to stderr john.liuli
@ 2014-08-26  2:47 ` Peter Crosthwaite
  2014-08-26 11:44 ` Markus Armbruster
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Crosthwaite @ 2014-08-26  2:47 UTC (permalink / raw)
  To: john.liuli; +Cc: Alexander Graf, qemu-devel@nongnu.org Developers

On Mon, Aug 25, 2014 at 6:44 PM, john.liuli <john.liuli@huawei.com> wrote:
> From: Li Liu <john.liuli@huawei.com>
>
> Signed-off-by: Li Liu <john.liuli@huawei.com>
> ---
>  device_tree.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/device_tree.c b/device_tree.c
> index ca83504..ccdb039 100644
> --- a/device_tree.c
> +++ b/device_tree.c
> @@ -79,7 +79,7 @@ void *load_device_tree(const char *filename_path, int *sizep)
>      *sizep = 0;
>      dt_size = get_image_size(filename_path);
>      if (dt_size < 0) {
> -        printf("Unable to get size of device tree file '%s'\n",
> +        fprintf(stderr, "Unable to get size of device tree file '%s'\n",
>              filename_path);
>          goto fail;
>      }
> @@ -92,20 +92,20 @@ void *load_device_tree(const char *filename_path, int *sizep)
>
>      dt_file_load_size = load_image(filename_path, fdt);
>      if (dt_file_load_size < 0) {
> -        printf("Unable to open device tree file '%s'\n",
> +        fprintf(stderr, "Unable to open device tree file '%s'\n",
>                 filename_path);

Indent this line by one more space to keep continued fn args aligned
to the "(". The other two are currently broken wrt to this issue, but
you could fix them too.

Otherwise:

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

I had some code somewhere that coverts this API to use Error **'s but
your patch is definitely a step in the right direction, while (and if)
that happens. I suggest cc'ing qemu-trivial for a merge.

Regards,
peter

>          goto fail;
>      }
>
>      ret = fdt_open_into(fdt, fdt, dt_size);
>      if (ret) {
> -        printf("Unable to copy device tree in memory\n");
> +        fprintf(stderr, "Unable to copy device tree in memory\n");
>          goto fail;
>      }
>
>      /* Check sanity of device tree */
>      if (fdt_check_header(fdt)) {
> -        printf ("Device tree file loaded into memory is invalid: %s\n",
> +        fprintf(stderr, "Device tree file loaded into memory is invalid: %s\n",
>              filename_path);
>          goto fail;
>      }
> --
> 1.7.9.5
>
>
>

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

* Re: [Qemu-devel] [PATCH] device_tree.c: redirect load_device_tree err message to stderr
  2014-08-25  8:44 [Qemu-devel] [PATCH] device_tree.c: redirect load_device_tree err message to stderr john.liuli
  2014-08-26  2:47 ` Peter Crosthwaite
@ 2014-08-26 11:44 ` Markus Armbruster
  2014-08-26 12:01   ` Markus Armbruster
  1 sibling, 1 reply; 4+ messages in thread
From: Markus Armbruster @ 2014-08-26 11:44 UTC (permalink / raw)
  To: john.liuli; +Cc: peter.crosthwaite, agraf, qemu-devel

"john.liuli" <john.liuli@huawei.com> writes:

> From: Li Liu <john.liuli@huawei.com>
>
> Signed-off-by: Li Liu <john.liuli@huawei.com>
> ---
>  device_tree.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/device_tree.c b/device_tree.c
> index ca83504..ccdb039 100644
> --- a/device_tree.c
> +++ b/device_tree.c
> @@ -79,7 +79,7 @@ void *load_device_tree(const char *filename_path, int *sizep)
>      *sizep = 0;
>      dt_size = get_image_size(filename_path);
>      if (dt_size < 0) {
> -        printf("Unable to get size of device tree file '%s'\n",
> +        fprintf(stderr, "Unable to get size of device tree file '%s'\n",
>              filename_path);
>          goto fail;
>      }
> @@ -92,20 +92,20 @@ void *load_device_tree(const char *filename_path, int *sizep)
>  
>      dt_file_load_size = load_image(filename_path, fdt);
>      if (dt_file_load_size < 0) {
> -        printf("Unable to open device tree file '%s'\n",
> +        fprintf(stderr, "Unable to open device tree file '%s'\n",
>                 filename_path);
>          goto fail;
>      }
>  
>      ret = fdt_open_into(fdt, fdt, dt_size);
>      if (ret) {
> -        printf("Unable to copy device tree in memory\n");
> +        fprintf(stderr, "Unable to copy device tree in memory\n");
>          goto fail;
>      }
>  
>      /* Check sanity of device tree */
>      if (fdt_check_header(fdt)) {
> -        printf ("Device tree file loaded into memory is invalid: %s\n",
> +        fprintf(stderr, "Device tree file loaded into memory is invalid: %s\n",
>              filename_path);
>          goto fail;
>      }

A welcome improvement.  Further improvement would be using
error_report().

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

* Re: [Qemu-devel] [PATCH] device_tree.c: redirect load_device_tree err message to stderr
  2014-08-26 11:44 ` Markus Armbruster
@ 2014-08-26 12:01   ` Markus Armbruster
  0 siblings, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2014-08-26 12:01 UTC (permalink / raw)
  To: john.liuli; +Cc: peter.crosthwaite, agraf, qemu-devel

Markus Armbruster <armbru@redhat.com> writes:

[...]
> A welcome improvement.  Further improvement would be using
> error_report().

Ah, you did that already in v2.  Sorry for the noise!

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

end of thread, other threads:[~2014-08-26 12:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-25  8:44 [Qemu-devel] [PATCH] device_tree.c: redirect load_device_tree err message to stderr john.liuli
2014-08-26  2:47 ` Peter Crosthwaite
2014-08-26 11:44 ` Markus Armbruster
2014-08-26 12:01   ` Markus Armbruster

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.