From patchwork Tue Feb 20 11:55:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 128888 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp4556235ljc; Tue, 20 Feb 2018 04:01:06 -0800 (PST) X-Google-Smtp-Source: AH8x227TBeOebe5WYER5bdHVEI1AUI0WQTcEALyY1Vn07yW8w4NGsCfBo9lpVoZVXJrTwtLhQTlK X-Received: by 10.98.204.69 with SMTP id a66mr10541660pfg.33.1519128066018; Tue, 20 Feb 2018 04:01:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519128066; cv=none; d=google.com; s=arc-20160816; b=ON+tnUi0b1OfNLYk+kI/sJJDjmb9RM7viE3zFfJIHLW3c4KGGgy7CjLGFrWVcMfd29 TG48PEysJ7e+Yjwxyrsrou/kZf3rqHFOLg+Vh7KWzfIGYabCmvs6LvUkNStgk3nSCnRT HSnb/nDVqiD5UxsONO5+WlO+zpvquZn4MRyIa2UeE0hRL+/APSsc3G8MPd2GqRsvMKY4 Ic4uVI3VHSYRSom/whG0D5KfeGxSpsJaII6tWslYhyz9vMsG5f9rl5/K4ch2jiKbZQgZ oSaWzhyWUSYjmX9Ffsk+glnqjmM+YTPq0Ye19UFiK8NmIhvJtnivVzT8yVDM3msd6N+o vXiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=jhotoyoWri2GEApGlRHagNVUionzj33ngEJXSTx05kA=; b=LmsUC+LLA4JxAQBnxN7Fq6AU9yV5rHxcGAq56HqsUwdtndpnIXgfVKq/Ju+wPJtxhF LsjpnaNLX8V6aJDLSvOA8UaIVgkfKLHxk0YeyZ1WjKynipuzuqEUpxd2CTa5FHqiCQfi dfoaYIJylE0jgfxipBHcSycCfmYih01gwxpagz1H8o7Zsc2xw6vTzWFU9G5h5w500QOA fZkQn/WVHczodOaD1d2ZiKmoh9kqhc3VOx5x3y5raMtZOZLfavuB4IEvmygew1vWBmDh iIJ8U+V/0SajBQxHU4MC64QZw1er1tBpqYdBOBgeGJ9AaArOQblb2Yv5K1ap/Kg5SWri /mFw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 70-v6si982276ple.465.2018.02.20.04.01.04; Tue, 20 Feb 2018 04:01:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751769AbeBTMBB (ORCPT + 28 others); Tue, 20 Feb 2018 07:01:01 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:48609 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751466AbeBTMA6 (ORCPT ); Tue, 20 Feb 2018 07:00:58 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.145]) with ESMTPA (Nemesis) id 0MK1R7-1enH6N3TRV-001O8e; Tue, 20 Feb 2018 12:59:31 +0100 From: Arnd Bergmann To: stable@vger.kernel.org Cc: Greg KH , linux-kernel@vger.kernel.org, Arnd Bergmann , Alexander Shishkin , Andy Lutomirski , Arnaldo Carvalho de Melo , Josh Poimboeuf , Linus Torvalds , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org Subject: [4.4-stable 15/22] perf/x86: Shut up false-positive -Wmaybe-uninitialized warning Date: Tue, 20 Feb 2018 12:55:02 +0100 Message-Id: <20180220115527.1806578-16-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180220115527.1806578-1-arnd@arndb.de> References: <20180220115527.1806578-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K0:hTy6pIpOSkbjYvtV8AoKEqc60knZbtc5iYHTNxQAOjxZ9rhupVB CAC80qyYX4ew1wgpLUXSPSgmrxf1oR15i8oHPhkQexoVNv6d4aJWHBgPJFr1jUZyMKQUiet YhUNVM5VxElhP4UKrX3hzXwreCZSgGQTKllR8ADsA7WAOApfhXpmL/OWXeYqWgthGKuvKoJ go+G+lI0Aclh70IZ6gzzA== X-UI-Out-Filterresults: notjunk:1; V01:K0:EwxmDRNc3kw=:iaFlXy5V7Fhi0+oaT8SGd2 5SZzafK7td3oJz0tI3/5wlUWg0RKmA0WgMHIrlh0ABYnCiLxDUQP2DAPcuJLg3ReEbdXb7LVi z0bJvO5c4ZbFBsmYd1yGo+R7FUhaRbSM/Vy/tSgNYkHnlYptydCCZD9SEfpwl3oeMzKV2QGq3 tTFNJ1FQjT9fKCR+Z0rNFrtzdwACJLfQ2ULBswdSo7v5rMjS8XqHhPJ22edATCs/N2wB/5E3u GfnYeRlWEDPIHf2xl0icGS2+aKWFqk37xHpI0Liu4r6CZTxmIiRbdFYKdkCALcRZT7Prujqrw NF5g4TmZYzAVTAgejylwUbPpmZwkKqMzD9p1zAnrWrU/96IMbMXa/ITQ+XJTrdUeymLMRt1Zk Ctv5zUecfDZ0EMfqSBcSUaaDJ+g/t70fuaJmYnCSkvytPIDyZR0hYXZIhR7a3KqZJSF3t4fto t6Y8F+AHwqj0MimpStbs+HKfirUwaNDGSqJdicutVXAjK4ggxpag9olBYm7S71Hn8S/MdhIGz PSVZ9YsZSo2A/PN4TDAxxOBOjWR7mLOIcCB2sOgMWJ7iZq6m1UVxsman8NDp4KUKFMYlRF7rO n9Rbj44LQ0WgDaDPKo2dewd6eMoWfXwIUuOLUeR3l+If/jjR8aYMLiF25eJmfmAP3UlaFx/9Z 1enbbHfkIh7VV0Vk2Lip+h2GNQ22UpE2LamGyaHK4nKlaELJRvfbZQo22QrM5YN+vWq5/7j+9 oMwKwH1i6x/ZFJATrhVSElRmc05jUlon69E1AJbU1VZxvm7zLH84sVcXol0= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit 11d8b05855f3749bcb6c57e2c4052921b9605c77 upstream. The intialization function checks for various failure scenarios, but unfortunately the compiler gets a little confused about the possible combinations, leading to a false-positive build warning when -Wmaybe-uninitialized is set: arch/x86/events/core.c: In function ‘init_hw_perf_events’: arch/x86/events/core.c:264:3: warning: ‘reg_fail’ may be used uninitialized in this function [-Wmaybe-uninitialized] arch/x86/events/core.c:264:3: warning: ‘val_fail’ may be used uninitialized in this function [-Wmaybe-uninitialized] pr_err(FW_BUG "the BIOS has corrupted hw-PMU resources (MSR %x is %Lx)\n", We can't actually run into this case, so this shuts up the warning by initializing the variables to a known-invalid state. Suggested-by: Peter Zijlstra Signed-off-by: Arnd Bergmann Cc: Alexander Shishkin Cc: Andy Lutomirski Cc: Arnaldo Carvalho de Melo Cc: Josh Poimboeuf Cc: Linus Torvalds Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20170719125310.2487451-2-arnd@arndb.de Link: https://patchwork.kernel.org/patch/9392595/ Signed-off-by: Ingo Molnar [arnd: rebased to 4.4] Signed-off-by: Arnd Bergmann --- arch/x86/kernel/cpu/perf_event.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.9.0 diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 5b2f2306fbcc..b52a8d08ab36 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c @@ -188,8 +188,8 @@ static void release_pmc_hardware(void) {} static bool check_hw_exists(void) { - u64 val, val_fail, val_new= ~0; - int i, reg, reg_fail, ret = 0; + u64 val, val_fail = -1, val_new= ~0; + int i, reg, reg_fail = -1, ret = 0; int bios_fail = 0; int reg_safe = -1;