[rtems commit] bsps/shared/ofw: Bug fixes

Christian Mauderer christianm at rtems.org
Mon Feb 8 20:25:38 UTC 2021


Module:    rtems
Branch:    master
Commit:    8b32f1d8c46f65ee8dea396d11df4117ca061e11
Changeset: http://git.rtems.org/rtems/commit/?id=8b32f1d8c46f65ee8dea396d11df4117ca061e11

Author:    G S Niteesh Babu <niteesh.gs at gmail.com>
Date:      Sat Feb  6 23:28:12 2021 +0530

bsps/shared/ofw: Bug fixes

Fixed bugs in rtems_ofw_get_prop, rtems_ofw_get_prop_len
and removed hardcoded value.

---

 bsps/shared/ofw/ofw.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bsps/shared/ofw/ofw.c b/bsps/shared/ofw/ofw.c
index 78576ec..1c3a817 100644
--- a/bsps/shared/ofw/ofw.c
+++ b/bsps/shared/ofw/ofw.c
@@ -162,7 +162,7 @@ ssize_t rtems_ofw_get_prop_len(
     return len + 1;
   }
 
-  if (prop == NULL && strcmp(propname, "/chosen") == 0) {
+  if (prop == NULL && offset == fdt_path_offset(fdtp, "/chosen")) {
     if (strcmp(propname, "fdtbootcpu") == 0)
       return sizeof(pcell_t);
     if (strcmp(propname, "fdtmemreserv") == 0)
@@ -210,7 +210,7 @@ ssize_t rtems_ofw_get_prop(
     return len + 1;
   }
 
-  if (prop == NULL && strcmp(propname, "/chosen") == 0) {
+  if (prop == NULL && offset == fdt_path_offset(fdtp, "/chosen")) {
     if (strcmp(propname, "fdtbootcpu") == 0) {
       cpuid = cpu_to_fdt32(fdt_boot_cpuid_phys(fdtp));
       len = sizeof(cpuid);
@@ -240,7 +240,7 @@ ssize_t rtems_ofw_get_enc_prop(
 {
   ssize_t rv;
 
-  assert(len % 4 == 0);
+  assert(len % sizeof(pcell_t) == 0);
   rv = rtems_ofw_get_prop(node, prop, buf, len);
 
   if (rv < 0) {



More information about the vc mailing list