[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-trivial] [PATCH] device_tree: load_device_tree(): Allow NULL sizep
From: |
Peter A. G. Crosthwaite |
Subject: |
[Qemu-trivial] [PATCH] device_tree: load_device_tree(): Allow NULL sizep |
Date: |
Fri, 10 Aug 2012 13:54:26 +1000 |
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>
Acked-by: Alexander Graf <address@hidden>
---
device_tree.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/device_tree.c b/device_tree.c
index d7a9b6b..641a48a 100644
--- a/device_tree.c
+++ b/device_tree.c
@@ -71,7 +71,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",
@@ -104,7 +106,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.0.4
- [Qemu-trivial] [PULL 0/1] device_tree: load_device_tree(): Allow NULL sizep, Peter A. G. Crosthwaite, 2012/08/09
- [Qemu-trivial] [PATCH] device_tree: load_device_tree(): Allow NULL sizep,
Peter A. G. Crosthwaite <=
- Re: [Qemu-trivial] [Qemu-devel] [PATCH] device_tree: load_device_tree(): Allow NULL sizep, Stefan Hajnoczi, 2012/08/10
- Re: [Qemu-trivial] [Qemu-devel] [PATCH] device_tree: load_device_tree(): Allow NULL sizep, Peter Crosthwaite, 2012/08/10
- Re: [Qemu-trivial] [Qemu-devel] [PATCH] device_tree: load_device_tree(): Allow NULL sizep, Stefan Hajnoczi, 2012/08/11
- Re: [Qemu-trivial] [Qemu-devel] [PATCH] device_tree: load_device_tree(): Allow NULL sizep, Stefan Hajnoczi, 2012/08/15
- Re: [Qemu-trivial] [Qemu-devel] [PATCH] device_tree: load_device_tree(): Allow NULL sizep, David Gibson, 2012/08/15
- Re: [Qemu-trivial] [Qemu-devel] [PATCH] device_tree: load_device_tree(): Allow NULL sizep, Stefan Hajnoczi, 2012/08/20