Re: [PATCH 01/15] mm: various small mmap_prepare cleanups

Andrew Morton
2026-03-12T21:14:33Z

On Thu, 12 Mar 2026 20:27:16 +0000 "Lorenzo Stoakes (Oracle)" <ljs@kernel.org> wrote:

> +int mmap_action_prepare(struct vm_area_desc *desc,
> + struct mmap_action *action)
> +
> {
> switch (action->type) {
> case MMAP_NOTHING:
> - break;
> + return 0;
> case MMAP_REMAP_PFN:
> - remap_pfn_range_prepare(desc, action->remap.start_pfn);
> - break;
> + return remap_pfn_range_prepare(desc, action);
> case MMAP_IO_REMAP_PFN:
> - io_remap_pfn_range_prepare(desc, action->remap.start_pfn,
> - action->remap.size);
> - break;
> + return io_remap_pfn_range_prepare(desc, action);
> }
> }
> EXPORT_SYMBOL(mmap_action_prepare);

hm, was this the correct version?

mm/util.c: In function 'mmap_action_prepare':
mm/util.c:1451:1: error: control reaches end of non-void function [-Werror=return-type]
1451 | }

--- a/mm/util.c~mm-various-small-mmap_prepare-cleanups-fix
+++ a/mm/util.c
@@ -1356,6 +1356,8 @@ int mmap_action_prepare(struct vm_area_d
return remap_pfn_range_prepare(desc, action);
case MMAP_IO_REMAP_PFN:
return io_remap_pfn_range_prepare(desc, action);
+ default:
+ BUG();
}
}
EXPORT_SYMBOL(mmap_action_prepare);
_