Re: [PATCH v1 2/8] x86/xen: simplify xen_oldmem_pfn_is_ram()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/28/21 2:22 PM, David Hildenbrand wrote:
> Let's simplify return handling.
>
> Signed-off-by: David Hildenbrand <david@xxxxxxxxxx>
> ---
>  arch/x86/xen/mmu_hvm.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/arch/x86/xen/mmu_hvm.c b/arch/x86/xen/mmu_hvm.c
> index b242d1f4b426..eb61622df75b 100644
> --- a/arch/x86/xen/mmu_hvm.c
> +++ b/arch/x86/xen/mmu_hvm.c
> @@ -21,23 +21,16 @@ static int xen_oldmem_pfn_is_ram(unsigned long pfn)
>  		.domid = DOMID_SELF,
>  		.pfn = pfn,
>  	};
> -	int ram;
>  
>  	if (HYPERVISOR_hvm_op(HVMOP_get_mem_type, &a))
>  		return -ENXIO;
>  
>  	switch (a.mem_type) {
>  	case HVMMEM_mmio_dm:
> -		ram = 0;
> -		break;
> -	case HVMMEM_ram_rw:
> -	case HVMMEM_ram_ro:
> +		return 0;
>  	default:
> -		ram = 1;
> -		break;
> +		return 1;
>  	}
> -
> -	return ram;
>  }
>  #endif
>  


How about

    return a.mem_type != HVMMEM_mmio_dm;


Result should be promoted to int and this has added benefit of not requiring changes in patch 4.


-boris




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux