On Thu, 5 Apr 2018 21:52:25 +0530 Souptick Joarder <jrdr.linux@xxxxxxxxx> wrote: > 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. > > ... > > --- 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; > +} > + That's a bit verbose. Why not simply return (err == -ENOMEM) ? VM_FAULT_OOM : VM_FAULT_SIGBUS; Also, if would be nice to see some sites converted so we can see the benefit of the patch and to actually test it.