[rtems commit] bsps: Copy FDT only if source != destination
Sebastian Huber
sebh at rtems.org
Fri Apr 22 12:31:10 UTC 2016
Module: rtems
Branch: master
Commit: 178180aa1c3f8804900476d1c671c2f090c0eea9
Changeset: http://git.rtems.org/rtems/commit/?id=178180aa1c3f8804900476d1c671c2f090c0eea9
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Apr 22 13:02:55 2016 +0200
bsps: Copy FDT only if source != destination
---
c/src/lib/libbsp/shared/src/bsp-fdt.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/c/src/lib/libbsp/shared/src/bsp-fdt.c b/c/src/lib/libbsp/shared/src/bsp-fdt.c
index 1b149d9..635cb85 100644
--- a/c/src/lib/libbsp/shared/src/bsp-fdt.c
+++ b/c/src/lib/libbsp/shared/src/bsp-fdt.c
@@ -42,15 +42,18 @@ void bsp_fdt_copy(const void *src)
#else
uint32_t *d = &bsp_fdt_blob[0];
#endif
- uint32_t m = MIN(sizeof(bsp_fdt_blob), fdt_totalsize(src));
- uint32_t n = (m + sizeof(*d) - 1) / sizeof(*d);
- uint32_t i;
- for (i = 0; i < n; ++i) {
- d[i] = s[i];
- }
+ if (s != d) {
+ uint32_t m = MIN(sizeof(bsp_fdt_blob), fdt_totalsize(src));
+ uint32_t n = (m + sizeof(*d) - 1) / sizeof(*d);
+ uint32_t i;
+
+ for (i = 0; i < n; ++i) {
+ d[i] = s[i];
+ }
- rtems_cache_flush_multiple_data_lines(d, m);
+ rtems_cache_flush_multiple_data_lines(d, m);
+ }
}
const void *bsp_fdt_get(void)
More information about the vc
mailing list