From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E156AC7618B for ; Fri, 26 Jul 2019 13:44:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BBFE822CD3 for ; Fri, 26 Jul 2019 13:44:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564148693; bh=1FOnbSF7WqPxZqQHFLMLT7wGOvQBsSTOeGGZhcbQPnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=VLPAso5COhU1/Vkj2DhOkueI/ta63Hus+M50rA4+Pz0+Z+3B+DyCfQThksI/zjexN 9cY4BGuWMZx9tIW6mU/1mGpvtqxMC88Ra4ewKyaBedOxBPRZ9O8kl4VMcu4kg9Bt8Z HW0ehao2MUMJABOWlLaVMRCbUU3eqpVJMA4axg7g= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388447AbfGZNow (ORCPT ); Fri, 26 Jul 2019 09:44:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:53272 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388439AbfGZNow (ORCPT ); Fri, 26 Jul 2019 09:44:52 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 55C2122CD7; Fri, 26 Jul 2019 13:44:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564148691; bh=1FOnbSF7WqPxZqQHFLMLT7wGOvQBsSTOeGGZhcbQPnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b/1gT6wSgapNyF6JThloKi2bQ2TbSD9Tuh3kosZ9Z85tBjP3NDZBirrrPdF/8jF7M rwBMYZbC3nRzWGOBbgi1+0/wSvVNQU2S13r4OSAHAmQiaicswH2dW9U6S4eT0SB4YU SucxtzGnV+hF1KqoHJFZTBnUFA+q9GpxnGxRPC4w= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Arnd Bergmann , Andy Shevchenko , Nathan Chancellor , "Rafael J . Wysocki" , Sasha Levin , linux-acpi@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH AUTOSEL 4.9 14/30] ACPI: fix false-positive -Wuninitialized warning Date: Fri, 26 Jul 2019 09:44:16 -0400 Message-Id: <20190726134432.12993-14-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190726134432.12993-1-sashal@kernel.org> References: <20190726134432.12993-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann [ Upstream commit dfd6f9ad36368b8dbd5f5a2b2f0a4705ae69a323 ] clang gets confused by an uninitialized variable in what looks to it like a never executed code path: arch/x86/kernel/acpi/boot.c:618:13: error: variable 'polarity' is uninitialized when used here [-Werror,-Wuninitialized] polarity = polarity ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH; ^~~~~~~~ arch/x86/kernel/acpi/boot.c:606:32: note: initialize the variable 'polarity' to silence this warning int rc, irq, trigger, polarity; ^ = 0 arch/x86/kernel/acpi/boot.c:617:12: error: variable 'trigger' is uninitialized when used here [-Werror,-Wuninitialized] trigger = trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE; ^~~~~~~ arch/x86/kernel/acpi/boot.c:606:22: note: initialize the variable 'trigger' to silence this warning int rc, irq, trigger, polarity; ^ = 0 This is unfortunately a design decision in clang and won't be fixed. Changing the acpi_get_override_irq() macro to an inline function reliably avoids the issue. Signed-off-by: Arnd Bergmann Reviewed-by: Andy Shevchenko Reviewed-by: Nathan Chancellor Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- include/linux/acpi.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/linux/acpi.h b/include/linux/acpi.h index ca2b4c4aec42..719eb97217a3 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -309,7 +309,10 @@ void acpi_set_irq_model(enum acpi_irq_model_id model, #ifdef CONFIG_X86_IO_APIC extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity); #else -#define acpi_get_override_irq(gsi, trigger, polarity) (-1) +static inline int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity) +{ + return -1; +} #endif /* * This function undoes the effect of one call to acpi_register_gsi(). -- 2.20.1