Re: [PATCH 6/6] KVM: Fix minor indentation and brace style issues

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

 



On Sat, 2022-03-05 at 15:55 -0500, Henry Sloan wrote:
> Signed-off-by: Henry Sloan <henryksloan@xxxxxxxxx>
> ---
>  virt/kvm/kvm_main.c | 36 +++++++++++++++++++-----------------
>  virt/kvm/pfncache.c |  2 +-
>  2 files changed, 20 insertions(+), 18 deletions(-)
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
[]
> @@ -2154,9 +2157,9 @@ static int kvm_clear_dirty_log_protect(struct kvm *kvm,
>  	n = ALIGN(log->num_pages, BITS_PER_LONG) / 8;
>  
>  	if (log->first_page > memslot->npages ||
> -	    log->num_pages > memslot->npages - log->first_page ||
> -	    (log->num_pages < memslot->npages - log->first_page && (log->num_pages & 63)))
> -	    return -EINVAL;
> +		log->num_pages > memslot->npages - log->first_page ||
> +		(log->num_pages < memslot->npages - log->first_page && (log->num_pages & 63)))
> +		return -EINVAL;

The change to indentation on the return statement is good
but the change to the indentation on the if statement block is not.

Perhaps a better change might be:

	if (log->first_page > memslot->npages ||
	    log->num_pages > memslot->npages - log->first_page ||
	    (log->num_pages < memslot->npages - log->first_page &&
	     (log->num_pages & 63)))
		return -EINVAL;

>  
>  	kvm_arch_sync_dirty_log(kvm, memslot);
>  
> @@ -2517,7 +2520,7 @@ static int hva_to_pfn_remapped(struct vm_area_struct *vma,
>  	 * tail pages of non-compound higher order allocations, which
>  	 * would then underflow the refcount when the caller does the
>  	 * required put_page. Don't allow those pages here.
> -	 */ 
> +	 */
>  	if (!kvm_try_get_pfn(pfn))
>  		r = -EFAULT;
>  
> @@ -2906,7 +2909,7 @@ int kvm_vcpu_read_guest(struct kvm_vcpu *vcpu, gpa_t gpa, void *data, unsigned l
>  EXPORT_SYMBOL_GPL(kvm_vcpu_read_guest);
>  
>  static int __kvm_read_guest_atomic(struct kvm_memory_slot *slot, gfn_t gfn,
> -			           void *data, int offset, unsigned long len)
> +						void *data, int offset, unsigned long len)
>  {
>  	int r;
>  	unsigned long addr;
> @@ -2923,7 +2926,7 @@ static int __kvm_read_guest_atomic(struct kvm_memory_slot *slot, gfn_t gfn,
>  }
>  
>  int kvm_vcpu_read_guest_atomic(struct kvm_vcpu *vcpu, gpa_t gpa,
> -			       void *data, unsigned long len)
> +						void *data, unsigned long len)

These whitespace changes are somewhat odd and unnecessary.
It's generally preferred to align to arguments to the open parenthesis.





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux