On 03.06.2021 13:55, Jason Andryuk wrote: > On Fri, May 28, 2021 at 2:35 AM Jan Beulich <jbeul...@suse.com> wrote: >> On 27.05.2021 20:50, Jason Andryuk wrote: >>> On Wed, May 26, 2021 at 11:00 AM Jan Beulich <jbeul...@suse.com> wrote: >>>> On 03.05.2021 21:28, Jason Andryuk wrote: >>>>> + hwp_verbose("HWP: FAST_IA32_HWP_REQUEST %ssupported\n", >>>>> + eax & CPUID6_EAX_FAST_HWP_MSR ? "" : "not "); >>>>> + if ( eax & CPUID6_EAX_FAST_HWP_MSR ) >>>>> + { >>>>> + if ( rdmsr_safe(MSR_FAST_UNCORE_MSRS_CAPABILITY, val) ) >>>>> + hwp_err("error >>>>> rdmsr_safe(MSR_FAST_UNCORE_MSRS_CAPABILITY)\n"); >>>>> + >>>>> + hwp_verbose("HWP: MSR_FAST_UNCORE_MSRS_CAPABILITY: %016lx\n", >>>>> val); >>>> >>>> Missing "else" above here? >>> >>> Are unbalanced braces acceptable or must they be balanced? Is this >>> acceptable: >>> if () >>> one; >>> else { >>> two; >>> three; >>> } >> >> Yes, it is. But I don't see how the question relates to my comment. >> All that needs to go in the else's body is the hwp_verbose(). > > 'val' shouldn't be used to set features when the rdmsr fails, so the > following code needs to be within the else. Unless you want to rely > on a failed rdmsr returning 0.
It is intentional for rdmsr_safe() to return a zero value when the access faulted, so I certainly think you may rely on this. Jan