On Fri, Nov 26, 2021 at 06:39:39PM +0000, Joao Martins wrote: > @@ -230,23 +235,18 @@ static vm_fault_t dev_dax_huge_fault(struct vm_fault *vmf, > id = dax_read_lock(); > switch (pe_size) { > case PE_SIZE_PTE: > - fault_size = PAGE_SIZE; > rc = __dev_dax_pte_fault(dev_dax, vmf, &pfn); > break; > case PE_SIZE_PMD: > - fault_size = PMD_SIZE; > rc = __dev_dax_pmd_fault(dev_dax, vmf, &pfn); > break; > case PE_SIZE_PUD: > - fault_size = PUD_SIZE; > rc = __dev_dax_pud_fault(dev_dax, vmf, &pfn); > break; > default: > rc = VM_FAULT_SIGBUS; > } > > dax_read_unlock(id); I wonder if if would make sense to move dax_read_lock / dax_read_unlock іnto the individul helpers as well now. That way you could directly return from the switch. Aso it seems like pfn is only an input parameter now and doesn't need to be passed by reference.