[PATCH 1/2] arm64/mm: Allow __create_pgd_mapping() to propagate pgtable_alloc() errors

Dev Jain dev.jain at arm.com
Fri Aug 15 00:30:14 PDT 2025


On 13/08/25 8:26 pm, Chaitanya S Prakash wrote:
> [-------snip-------------]
>   
> -static void __create_pgd_mapping(pgd_t *pgdir, phys_addr_t phys,
> +static int __create_pgd_mapping(pgd_t *pgdir, phys_addr_t phys,
>   				 unsigned long virt, phys_addr_t size,
>   				 pgprot_t prot,
>   				 phys_addr_t (*pgtable_alloc)(enum pgtable_type),
>   				 int flags)
>   {
> +	int ret = 0;
> +
>   	mutex_lock(&fixmap_lock);
> -	__create_pgd_mapping_locked(pgdir, phys, virt, size, prot,
> -				    pgtable_alloc, flags);
> +	ret = __create_pgd_mapping_locked(pgdir, phys, virt, size, prot,
> +					  pgtable_alloc, flags);
>   	mutex_unlock(&fixmap_lock);
> +
> +	return ret;
> +}
> +
> +static void ___create_pgd_mapping(pgd_t *pgdir, phys_addr_t phys,
> +				  unsigned long virt, phys_addr_t size,
> +				  pgprot_t prot,
> +				  phys_addr_t (*pgtable_alloc)(enum pgtable_type),
> +				  int flags)
> +{
> +	int ret = 0;
> +
> +	ret = __create_pgd_mapping(pgdir, phys, virt, size, prot, pgtable_alloc,
> +				   flags);
> +	BUG_ON(ret);
>   }

A triple underscore calling a double underscore isn't natural to reason about.
Since this is the function which must succeed, how does "must_create_pgd_mapping()"
sound?






More information about the linux-arm-kernel mailing list