The 'lbr-fmt' property is defined via DEFINE_PROP_UINT64_CHECKMASK, utilizing PERF_CAP_LBR_FMT as the validation mask. This mechanism ensures that the property setter rejects any value attempting to set bits outside this mask. So cpu->lbr_fmt is guaranteed to be valid by the time x86_cpu_realizefn() executes. The manual validation inside the realize function is therefore redundant. Remove the unnecessary check. Signed-off-by: Zhao Liu <zhao1.liu@intel.com> --- target/i386/cpu.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index c2f99b98014a..a594747f0030 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -9816,10 +9816,6 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp) * with user-provided setting. */ if (cpu->lbr_fmt != ~PERF_CAP_LBR_FMT) { - if ((cpu->lbr_fmt & PERF_CAP_LBR_FMT) != cpu->lbr_fmt) { - error_setg(errp, "invalid lbr-fmt"); - return; - } env->features[FEAT_PERF_CAPABILITIES] &= ~PERF_CAP_LBR_FMT; env->features[FEAT_PERF_CAPABILITIES] |= cpu->lbr_fmt; } -- 2.34.1