[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xen: introduce function type bug_fn_t.
commit 98758ae48974d6d24f999e4d9324e463d326f66f Author: Federico Serafini <federico.serafini@xxxxxxxxxxx> AuthorDate: Fri Nov 17 09:28:26 2023 +0100 Commit: Stefano Stabellini <stefano.stabellini@xxxxxxx> CommitDate: Fri Nov 17 18:29:51 2023 -0800 xen: introduce function type bug_fn_t. Introduce function type bug_fn_t. This improves readability and could be used to help validating that the function passed to run_in_exception_handle() has the expected prototype. Use the newly-intoduced type to address a violation of MISRA C:2012 Rule 8.2. Suggested-by: Julien Grall <julien@xxxxxxx> Signed-off-by: Federico Serafini <federico.serafini@xxxxxxxxxxx> [stefano: minor commit improvement] Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx> Acked-by: Julien Grall <jgrall@xxxxxxxxxx> --- xen/arch/arm/traps.c | 2 +- xen/include/xen/bug.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index ce89f16404..8492e2b7bb 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1236,7 +1236,7 @@ int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc) if ( id == BUGFRAME_run_fn ) { - void (*fn)(const struct cpu_user_regs *) = (void *)regs->BUG_FN_REG; + bug_fn_t *fn = (void *)regs->BUG_FN_REG; fn(regs); return 0; diff --git a/xen/include/xen/bug.h b/xen/include/xen/bug.h index e8a4eea71a..cb5138410e 100644 --- a/xen/include/xen/bug.h +++ b/xen/include/xen/bug.h @@ -99,6 +99,9 @@ struct bug_frame { #endif +struct cpu_user_regs; +typedef void bug_fn_t(const struct cpu_user_regs *regs); + #ifndef run_in_exception_handler /* @@ -132,8 +135,6 @@ struct bug_frame { #ifdef CONFIG_GENERIC_BUG_FRAME -struct cpu_user_regs; - /* * Returns a negative value in case of an error otherwise * BUGFRAME_{run_fn, warn, bug, assert} -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |