From patchwork Mon Jun 19 18:31:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Willy Tarreau X-Patchwork-Id: 105919 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1017029qgd; Mon, 19 Jun 2017 11:58:03 -0700 (PDT) X-Received: by 10.99.0.212 with SMTP id 203mr27221739pga.259.1497898683093; Mon, 19 Jun 2017 11:58:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497898683; cv=none; d=google.com; s=arc-20160816; b=w9ryF2lvnzoc7FnPXKB+uWAbPFKwCARnA/BK13+JUdoYyemFY4oIWjFrdie+iqv0gH 90yaqb1hBtCa+lnqXVS6u0bDVxQnwqzfLX/CcK7gMJIZkm/QQpNhQTNRN8s0Y8aE0Ejo OindhgYI0DF0WC/M7Ha3nn1WvaicjxDUgG8jh90WoWdi60256nPfdOmM8PDt2lOZEHyk VqaEej/JgYHa7SRHvsV4vTk6M9qZ1yPiRW1P/i8FX6KcgsOFu/uO4joC07EZdjrziXlJ aQ1GDIXZ9c5Wvy10WnpITrTBvBKvekUE5W1EnO6EzKuHNlM267yHP6IMtu11wGan5KUF P5sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=CxWdcURlnVhrgy69hdmJJdcIvFbQkblCkh+6nNAZLAQ=; b=T7U9sgqBl6oy+O4vLLFT2P1WaLzPoamXkRr7nANpPsuFB4GlqvVSBPIjOwuPO/mvsZ 5QiA4yiKazzN5vylzeO+vbZyjnoZ353SDmeabMro+wPTdnMa3D9kQS8J2nXqeRz0R0OT hBtp1ipr+bsk/eib1MTwgDfFyUf958LGimbnZdB0Bt5oOwgZXEJ6xH7BfhyIZvbKhJmv GZ70f5HUh5APERhYehUExNs42hxe9JOEfMdlxddZyi1X6ped3WXNeZ+3/iWTApEYbXRG DfmK0vZ61bO7XfQrWY7SWs8VHOXvjrtXkmDI0ToBXr9RXUb2aeASYZFdzK165vbHrgW8 ifmA== 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 l22si4672523pgo.408.2017.06.19.11.58.02; Mon, 19 Jun 2017 11:58:03 -0700 (PDT) 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 S1753247AbdFSS5u (ORCPT + 25 others); Mon, 19 Jun 2017 14:57:50 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:52591 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753830AbdFSSiA (ORCPT ); Mon, 19 Jun 2017 14:38:00 -0400 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id v5JIXm0j015078; Mon, 19 Jun 2017 20:33:48 +0200 From: Willy Tarreau To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux@roeck-us.net Cc: Arnd Bergmann , "Rafael J . Wysocki" , Willy Tarreau Subject: [PATCH 3.10 212/268] ACPI / power: Avoid maybe-uninitialized warning Date: Mon, 19 Jun 2017 20:31:51 +0200 Message-Id: <1497897167-14556-213-git-send-email-w@1wt.eu> X-Mailer: git-send-email 2.8.0.rc2.1.gbe9624a In-Reply-To: <1497897167-14556-1-git-send-email-w@1wt.eu> References: <1497897167-14556-1-git-send-email-w@1wt.eu> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann commit fe8c470ab87d90e4b5115902dd94eced7e3305c3 upstream. gcc -O2 cannot always prove that the loop in acpi_power_get_inferred_state() is enterered at least once, so it assumes that cur_state might not get initialized: drivers/acpi/power.c: In function 'acpi_power_get_inferred_state': drivers/acpi/power.c:222:9: error: 'cur_state' may be used uninitialized in this function [-Werror=maybe-uninitialized] This sets the variable to zero at the start of the loop, to ensure that there is well-defined behavior even for an empty list. This gets rid of the warning. The warning first showed up when the -Os flag got removed in a bug fix patch in linux-4.11-rc5. I would suggest merging this addon patch on top of that bug fix to avoid introducing a new warning in the stable kernels. Fixes: 61b79e16c68d (ACPI: Fix incompatibility with mcount-based function graph tracing) Signed-off-by: Arnd Bergmann Signed-off-by: Rafael J. Wysocki Signed-off-by: Willy Tarreau --- drivers/acpi/power.c | 1 + 1 file changed, 1 insertion(+) -- 2.8.0.rc2.1.gbe9624a diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 288bb27..9954200 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c @@ -211,6 +211,7 @@ static int acpi_power_get_list_state(struct list_head *list, int *state) return -EINVAL; /* The state of the list is 'on' IFF all resources are 'on'. */ + cur_state = 0; list_for_each_entry(entry, list, node) { struct acpi_power_resource *resource = entry->resource; acpi_handle handle = resource->device.handle;