On 11/12/2023 13:29, Julien Grall wrote: > > > Hi, > > On 11/12/2023 10:30, Nicola Vetrini wrote: >> The "return 1;" statements at the end of some cases in the switch >> of function 'vgic_v3_its_mmio_write' in 'vcig-v3-its.c' cause the >> unreachability of the "return 1;" statement after the switch, thus >> violating MISRA C:2012 Rule 2.1: >> "A project shall not contain unreachable code". >> >> The same is true for the switch in 'arch_memory_op' from >> 'xen/arch/arm/mm.c'. > > For both cases, I actually much prefer the "return" version in the > cases. In particular for the vGIC emulation the switch is quite large > and it would not be trivial to know what happens after the break. Because of this... > > IOW, I would much prefer if we remove the "return ..." outside of the > switch. wouldn't it be better to add ASSERT_UNREACHABLE() before this return instead of removing it? This is what we have in e.g. vpl011 and it prevents mistakes. ~Michal
- Re: [XEN PATCH 2/7] x86/mm: address MI... Nicola Vetrini
- Re: [XEN PATCH 2/7] x86/mm: addre... Jan Beulich
- Re: [XEN PATCH 2/7] x86/mm: a... Nicola Vetrini
- [XEN PATCH 6/7] x86/platform: removed break to address ... Nicola Vetrini
- Re: [XEN PATCH 6/7] x86/platform: removed break to... Stefano Stabellini
- Re: [XEN PATCH 6/7] x86/platform: removed break to... Jan Beulich
- Re: [XEN PATCH 6/7] x86/platform: removed brea... Stefano Stabellini
- Re: [XEN PATCH 6/7] x86/platform: removed brea... Nicola Vetrini
- [XEN PATCH 3/7] xen/arm: address MISRA C:2012 Rule 2.1 Nicola Vetrini
- Re: [XEN PATCH 3/7] xen/arm: address MISRA C:2012 ... Julien Grall
- Re: [XEN PATCH 3/7] xen/arm: address MISRA C:2... Michal Orzel
- Re: [XEN PATCH 3/7] xen/arm: address MISRA... Julien Grall
- Re: [XEN PATCH 3/7] xen/arm: address M... Nicola Vetrini
- [XEN PATCH 4/7] xen/sched: address MISRA C:2012 Rule 2.... Nicola Vetrini
- Re: [XEN PATCH 4/7] xen/sched: address MISRA C:201... George Dunlap
- Re: [XEN PATCH 4/7] xen/sched: address MISRA C:201... Stefano Stabellini