Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3914388pxf; Mon, 22 Mar 2021 20:00:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXJNKGqnTMtS8YbWMipi8fyA8FNYzmh/QS7WWkaQmi5f+OOkadMQM6TIxcPMVPvNd6SR48 X-Received: by 2002:a17:906:32da:: with SMTP id k26mr2635989ejk.483.1616468455423; Mon, 22 Mar 2021 20:00:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616468455; cv=none; d=google.com; s=arc-20160816; b=0Yg0C53JBiny6b64B9QbDAt7NXHefNrheuFhd/SrzlD4jO5MI+i6PCFsa0xA+tY5ln OD7Oy4O8RcGmzBkwehe98HoOK+yJoR9xuXVmwbuA517+nQzM4Ccy9WLnnoKw4AKDUcFL w3BSWeOvS2P3OXyppo6faL4OPkiclNYw/mUVrTi+rweIS6McJuxmqYshpu+COtDha7K6 ibw7NOsHG9m0a0J8Od8MU3+y/MMrMGjPX0v2j2Ce0/Q8VCGXNxRBNf4Y+oHtfnX3QWgB AcIta4Ko1dzt/P3il8sU1jbYxeH7EbJTX4YKCW3dwGskJYm1fs6KMzLUKyNn/si4M5No oovQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Kf94bRWFncSfACmh/oqJGHQ3p1LQShC8yXaQTTU8hww=; b=vXGO1NdUizF9CxxZTrsOthPUWB0n/Ar80IQp6FsJW8r2ZFyDmMnNqPqkGJOqPZqTxm GXxjh6TxJn10e9Z5rcVQGJOqYiBsYQHBPEHZhwLGhXLJAnnpkFRwqu67Gs7f96eafZlG 1GtRU4GSgaXLvK7B9BPmtvsjij3phshkLt1HYAi551f0uc9jOy3gqO6JUO8W2zAJ0PCS d8/8sEyq97+QGo3jLtlUF/Lqx5pZ3/9U3wW7gXctM+yBIdkDAEum+ir/igWv+zpDJxbK G6BLjH5N9XJxawXJgfQevyxmZQGagh518sjcB65Wvj1Jt95YG0NMMGrElLwqpQ7UmmBi GrVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e12si12649870ejs.501.2021.03.22.20.00.33; Mon, 22 Mar 2021 20:00:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229872AbhCWC7W (ORCPT + 99 others); Mon, 22 Mar 2021 22:59:22 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13661 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbhCWC7Q (ORCPT ); Mon, 22 Mar 2021 22:59:16 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4F4GH11vSYznVX2; Tue, 23 Mar 2021 10:56:45 +0800 (CST) Received: from vm-Yoda-Ubuntu1804.huawei.com (10.67.174.59) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.498.0; Tue, 23 Mar 2021 10:59:07 +0800 From: Xu Yihang To: , , , , , , , , , , CC: , Subject: [PATCH -next] =?UTF-8?q?x86:=20Fix=20intel=20cpu=20unsed=20variab?= =?UTF-8?q?le=20=E2=80=98l2=E2=80=99=20warning?= Date: Tue, 23 Mar 2021 10:59:01 +0800 Message-ID: <20210323025901.205381-1-xuyihang@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.174.59] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fixes the following W=1 kernel build warning(s): ../arch/x86/kernel/cpu/intel.c: In function ‘init_intel’: ../arch/x86/kernel/cpu/intel.c:644:20: warning: variable ‘l2’ set but not used [-Wunused-but-set-variable] unsigned int l1, l2; ^~ Compilation command(s): make allmodconfig ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu- make W=1 arch/x86/kernel/cpu/intel.o ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu- According to Intel Software Developer's Manual Table 2-2 through Table 2-24 about MSRs: X86_FEATURE_BTS which represents Branch Trace Storage Unavailable and X86_FEATURE_PEBS represens Processor Event Based Sampling (PEBS) Unavailable, but on some platform these fields maybe reserved or not available. For the function init_intel it self, only bit 11 and bit 12 are used for checking BTS and PEBS, and higher 32 bits are not used. So cast to void to avoid warning. Reported-by: Hulk Robot Signed-off-by: Xu Yihang --- arch/x86/kernel/cpu/intel.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 63e381a46153..547ba6668eb3 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c @@ -644,6 +644,7 @@ static void init_intel(struct cpuinfo_x86 *c) unsigned int l1, l2; rdmsr(MSR_IA32_MISC_ENABLE, l1, l2); + (void) l2; if (!(l1 & (1<<11))) set_cpu_cap(c, X86_FEATURE_BTS); if (!(l1 & (1<<12))) -- 2.17.1