On Fri, Nov 11, 2022, Like Xu wrote: > From: Sean Christopherson <seanjc@xxxxxxxxxx> > > Invert the flows in intel_pmu_set_msr()'s case statements so that they > follow the kernel's preferred style of: > > if (<not valid>) > return <error> > > <commit change> > return <success> > > which is also the style used by every other set_msr() helper (except > AMD's PMU variant, which doesn't use a switch statement). > > Opportunstically move the "val == current" checks below the validity > checks. Except for the one-off case for MSR_P6_EVNTSEL2, the reserved > bit checks are extremely cheap, and the guest is unlikely to frequently > write the current value, i.e. avoiding the reserved bit checks doesn't > add much (any?) value. > > No functional change intended. > > Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx> FYI, I'm going to post this separately and extend it to give the get_msr() flow the same treatment. I'll plan on getting it queued sooner than later so that this series can use it as a base.