qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v3 7/8] target/i386/kvm: Clean up return values of MSR filter


From: Chen, Zide
Subject: Re: [PATCH v3 7/8] target/i386/kvm: Clean up return values of MSR filter related functions
Date: Mon, 15 Jul 2024 15:18:07 -0700
User-agent: Mozilla Thunderbird


On 7/14/2024 9:49 PM, Zhao Liu wrote:
> @@ -5274,13 +5272,13 @@ void kvm_arch_update_guest_debug(CPUState *cpu, 
> struct kvm_guest_debug *dbg)
>      }
>  }
>  
> -static bool kvm_install_msr_filters(KVMState *s)
> +static int kvm_install_msr_filters(KVMState *s)
>  {
>      uint64_t zero = 0;
>      struct kvm_msr_filter filter = {
>          .flags = KVM_MSR_FILTER_DEFAULT_ALLOW,
>      };
> -    int r, i, j = 0;
> +    int ret, i, j = 0;
>  
>      for (i = 0; i < KVM_MSR_FILTER_MAX_RANGES; i++) {

Nit: Since it's a clean up patch, how about replace
KVM_MSR_FILTER_MAX_RANGES with ARRAY_SIZE(msr_handlers), to make the
code consistent in other places to refer to the array size of
msr_handlers[].

>          KVMMSRHandlers *handler = &msr_handlers[i];
> @@ -5304,18 +5302,18 @@ static bool kvm_install_msr_filters(KVMState *s)
>          }
>      }
>  
> -    r = kvm_vm_ioctl(s, KVM_X86_SET_MSR_FILTER, &filter);
> -    if (r) {
> -        return false;
> +    ret = kvm_vm_ioctl(s, KVM_X86_SET_MSR_FILTER, &filter);
> +    if (ret) {
> +        return ret;
>      }
>  
> -    return true;
> +    return 0;
>  }

Nit: Seems ret is not needed here, and can directly return kvm_vm_ioctl();



reply via email to

[Prev in Thread] Current Thread [Next in Thread]