qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v1] device_tree: load_device_tree(): Allow NULL


From: Peter Crosthwaite
Subject: Re: [Qemu-devel] [PATCH v1] device_tree: load_device_tree(): Allow NULL sizep
Date: Fri, 22 Jun 2012 23:17:15 +1000

CC device-tree.c original contributors. (Jerome Young and Hollis Blanchard).

I cant find a maintainer for device-tree, and Stefan wants a review.
This patch seem ok?

On Thu, Jun 21, 2012 at 2:51 PM, Peter A. G. Crosthwaite
<address@hidden> wrote:
> The sizep arg is populated with the size of the loaded device tree. Since this
> is one of those informational "please populate" type arguments it should be
> optional. Guarded writes to *sizep against NULL accordingly.
>
> Signed-off-by: Peter A. G. Crosthwaite <address@hidden>
> ---
>  device_tree.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/device_tree.c b/device_tree.c
> index 86a694c..0ed0256 100644
> --- a/device_tree.c
> +++ b/device_tree.c
> @@ -32,7 +32,9 @@ void *load_device_tree(const char *filename_path, int 
> *sizep)
>     int ret;
>     void *fdt = NULL;
>
> -    *sizep = 0;
> +    if (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",
> @@ -65,7 +67,9 @@ void *load_device_tree(const char *filename_path, int 
> *sizep)
>             filename_path);
>         goto fail;
>     }
> -    *sizep = dt_size;
> +    if (sizep) {
> +        *sizep = dt_size;
> +    }
>     return fdt;
>
>  fail:
> --
> 1.7.3.2
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]