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

[xen staging] device-tree: address violation of MISRA C Rule 5.5



commit 84f396715332be01106bf91634a508deb8e23e8c
Author:     Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
AuthorDate: Thu Jul 10 13:42:56 2025 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Jul 10 13:42:56 2025 +0200

    device-tree: address violation of MISRA C Rule 5.5
    
    Address a violation of MISRA C:2012 Rule 5.5:
    "Identifiers shall be distinct from macro names".
    
    Reports for service MC3A2.R5.5:
    xen/include/xen/fdt-domain-build.h: non-compliant parameter 'copy_to_guest'
    xen/include/xen/guest_access.h: non-compliant macro 'copy_to_guest'
    
    Rename 'copy_to_guest' function parameter to 'cb' for compliance.
    No functional changes.
    
    Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/common/device-tree/domain-build.c | 13 ++++++-------
 xen/include/xen/fdt-domain-build.h    |  4 ++--
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/xen/common/device-tree/domain-build.c 
b/xen/common/device-tree/domain-build.c
index e6d7b8961e..4eea095e49 100644
--- a/xen/common/device-tree/domain-build.c
+++ b/xen/common/device-tree/domain-build.c
@@ -336,7 +336,7 @@ void __init allocate_memory(struct domain *d, struct 
kernel_info *kinfo)
 }
 
 void __init dtb_load(struct kernel_info *kinfo,
-                     copy_to_guest_phys_cb copy_to_guest)
+                     copy_to_guest_phys_cb cb)
 {
     unsigned long left;
 
@@ -344,9 +344,9 @@ void __init dtb_load(struct kernel_info *kinfo,
            kinfo->d, kinfo->dtb_paddr,
            kinfo->dtb_paddr + fdt_totalsize(kinfo->fdt));
 
-    left = copy_to_guest(kinfo->d, kinfo->dtb_paddr,
-                         kinfo->fdt,
-                         fdt_totalsize(kinfo->fdt));
+    left = cb(kinfo->d, kinfo->dtb_paddr,
+              kinfo->fdt,
+              fdt_totalsize(kinfo->fdt));
 
     if ( left != 0 )
         panic("Unable to copy the DTB to %pd memory (left = %lu bytes)\n",
@@ -355,7 +355,7 @@ void __init dtb_load(struct kernel_info *kinfo,
 }
 
 void __init initrd_load(struct kernel_info *kinfo,
-                        copy_to_guest_phys_cb copy_to_guest)
+                        copy_to_guest_phys_cb cb)
 {
     const struct boot_module *mod = kinfo->initrd;
     paddr_t load_addr = kinfo->initrd_paddr;
@@ -398,8 +398,7 @@ void __init initrd_load(struct kernel_info *kinfo,
     if ( !initrd )
         panic("Unable to map the %pd initrd\n", kinfo->d);
 
-    res = copy_to_guest(kinfo->d, load_addr,
-                        initrd, len);
+    res = cb(kinfo->d, load_addr, initrd, len);
     if ( res != 0 )
         panic("Unable to copy the initrd in the %pd memory\n", kinfo->d);
 
diff --git a/xen/include/xen/fdt-domain-build.h 
b/xen/include/xen/fdt-domain-build.h
index 45981dbec0..3a20623cf5 100644
--- a/xen/include/xen/fdt-domain-build.h
+++ b/xen/include/xen/fdt-domain-build.h
@@ -50,10 +50,10 @@ typedef unsigned long (*copy_to_guest_phys_cb)(struct 
domain *d,
                                                unsigned int len);
 
 void initrd_load(struct kernel_info *kinfo,
-                 copy_to_guest_phys_cb copy_to_guest);
+                 copy_to_guest_phys_cb cb);
 
 void dtb_load(struct kernel_info *kinfo,
-              copy_to_guest_phys_cb copy_to_guest);
+              copy_to_guest_phys_cb cb);
 
 int find_unallocated_memory(const struct kernel_info *kinfo,
                             const struct membanks *mem_banks[],
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.