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

[xen master] xen/arm: address MISRA C:2012 Rule 2.1



commit c877b9092885bc052cc89383585b83d045d392c2
Author:     Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
AuthorDate: Mon Dec 18 11:17:29 2023 +0100
Commit:     Stefano Stabellini <stefano.stabellini@xxxxxxx>
CommitDate: Tue Dec 19 17:13:36 2023 -0800

    xen/arm: address MISRA C:2012 Rule 2.1
    
    There are no paths that can reach the last return statement
    of function 'vgic_v3_its_mmio_write' in 'vcig-v3-its.c' and
    'arch_memory_op' in 'arch/arm/mm.c', thus violating
    MISRA C:2012 Rule 2.1:
    "A project shall not contain unreachable code".
    
    Therefore, an ASSERT_UNREACHABLE() is inserted to remove the unreachable
    return statement and protect against possible mistakes.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/arch/arm/mm.c          | 1 +
 xen/arch/arm/vgic-v3-its.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index eeb65ca6bb..b15a18a494 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -283,6 +283,7 @@ long arch_memory_op(int op, XEN_GUEST_HANDLE_PARAM(void) 
arg)
         return -ENOSYS;
     }
 
+    ASSERT_UNREACHABLE();
     return 0;
 }
 
diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c
index 05429030b5..70b5aeb822 100644
--- a/xen/arch/arm/vgic-v3-its.c
+++ b/xen/arch/arm/vgic-v3-its.c
@@ -1409,6 +1409,7 @@ static int vgic_v3_its_mmio_write(struct vcpu *v, 
mmio_info_t *info,
         return 0;
     }
 
+    ASSERT_UNREACHABLE();
     return 1;
 
 write_ignore_64:
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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