[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] mm: add the __must_check attribute to {gfn,mfn,dfn}_add()
commit 4917b9a423cbb09a44403c6a0d292a4baf85b93c Author: Roger Pau Monné <roger.pau@xxxxxxxxxx> AuthorDate: Mon Feb 19 12:44:50 2024 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Mon Feb 19 12:44:50 2024 +0100 mm: add the __must_check attribute to {gfn,mfn,dfn}_add() It's not obvious from just the function name whether the incremented value will be stored in the parameter, or returned to the caller. That has leads to bugs in the past as callers may assume the incremented value is stored in the parameter. Add the __must_check attribute to the function to easily spot callers that don't consume the returned value, which signals an error in the caller logic. No functional change intended. Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> Acked-by: Julien Grall <jgrall@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/include/xen/iommu.h | 2 +- xen/include/xen/mm-frame.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h index 7aa6a77209..9621459c63 100644 --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -42,7 +42,7 @@ TYPE_SAFE(uint64_t, dfn); #undef dfn_x #endif -static inline dfn_t dfn_add(dfn_t dfn, unsigned long i) +static inline dfn_t __must_check dfn_add(dfn_t dfn, unsigned long i) { return _dfn(dfn_x(dfn) + i); } diff --git a/xen/include/xen/mm-frame.h b/xen/include/xen/mm-frame.h index 922ae41880..c25e836f25 100644 --- a/xen/include/xen/mm-frame.h +++ b/xen/include/xen/mm-frame.h @@ -23,7 +23,7 @@ TYPE_SAFE(unsigned long, mfn); #undef mfn_x #endif -static inline mfn_t mfn_add(mfn_t mfn, unsigned long i) +static inline mfn_t __must_check mfn_add(mfn_t mfn, unsigned long i) { return _mfn(mfn_x(mfn) + i); } @@ -62,7 +62,7 @@ TYPE_SAFE(unsigned long, gfn); #undef gfn_x #endif -static inline gfn_t gfn_add(gfn_t gfn, unsigned long i) +static inline gfn_t __must_check gfn_add(gfn_t gfn, unsigned long i) { return _gfn(gfn_x(gfn) + i); } -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |