Many places in drivers/ file systems error was handled like below - ret = (ret == -ENOMEM) ? VM_FAULT_OOM : VM_FAULT_SIGBUS; This new inline function vmf_error() will replace this and return vm_fault_t type err. Signed-off-by: Souptick Joarder <jrdr.linux@xxxxxxxxx> --- include/linux/mm.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index a4d8853..e283dd8 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2453,6 +2453,18 @@ static inline vm_fault_t vmf_insert_pfn(struct vm_area_struct *vma, return VM_FAULT_NOPAGE; } +static inline vm_fault_t vmf_error(int err) +{ + vm_fault_t ret; + + if (err == -ENOMEM) + ret = VM_FAULT_OOM; + else + ret = VM_FAULT_SIGBUS; + + return ret; +} + struct page *follow_page_mask(struct vm_area_struct *vma, unsigned long address, unsigned int foll_flags, unsigned int *page_mask); -- 1.9.1