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=-18.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,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 38148C433B4 for ; Thu, 1 Apr 2021 16:30:38 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8625B610CC for ; Thu, 1 Apr 2021 16:30:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8625B610CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=AahCYaqsvllwgO/po05R9LyHzn8uv0eTiwEVw+e6Tic=; b=EL5Cy2BbQ7uoNgm5XY0HxwQt8p cORQSQUaZLXrFGW5tUX3xNqeMqwOMnZhWujOvEzZEB6xU/IdA66C+XgFX4IbdWCnkaCYnywO+U2Dg /UrKEq5ImhUD2i/hqSd2K00c4D++9K1Iq5GyfYlqLIQs9YumzmYRaYqU/Xnj1pVwcI7h8VahXa8+8 Qt0K3kYti9RSRCvnOAnB4lG34JC1rvktq7ZcQq64LHQFmUVoU5V0TDkmI0GJ8gdb57EfUe2w+eipD G0JLdfB7dY/lLVYtwCxaLX7mQssyEieV+1JNXXJPpPId6z921qUOkTO/sfPVHl/aySaiBAG7FfJba 70rekQVw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lS0Bl-00AItD-LJ; Thu, 01 Apr 2021 16:28:59 +0000 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lRzw1-00ABuR-Bk for linux-arm-kernel@lists.infradead.org; Thu, 01 Apr 2021 16:12:44 +0000 Received: by mail-lj1-x235.google.com with SMTP id r20so2856547ljk.4 for ; Thu, 01 Apr 2021 09:12:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=r2enjizmpD/LJygPj4XEpQS/6/yzRXEF2wF7GTPmSXo=; b=KyF3n3noNl+TF4SyZKEn3jqL0Mzlp8c6bW86UpMr0aPNIIUPyLsI61pZeNXgA6PwAD wtYKQFIZc3XNHc+wGhz6vJWtEUGczM+s5yO4a21aLeQDUt0C476NSjWybeLLLsSxzuv3 wS7dD9KBYCSl8nDJB1lJrgZxACXRZ1jJcNoluQWLGdq8drqI+0kro/pqmrX0V5m2754/ Lh8Nv6nsac84VCAYU/AyyH44y1hQ2rUN8EnBO8ZS6RhdFm7yQTUOvPtosrCUrFVX7ubT D65RGfnGaBJhMlVWWEpaeaL3h/23JxZImJs7qLSg66uHwgDoCeVzv/jBsVnTXRV/D9YC OhqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=r2enjizmpD/LJygPj4XEpQS/6/yzRXEF2wF7GTPmSXo=; b=Uz/Ho9narJRE7eZQljo7liWrY3eaXhy3JiFko45/ozDh8TPCMpqfIPLvQjqAhjPsVb me7X0kgjdOlhtXwNZYz6CKktBpIJPmqy2RjOI7Hnhbr6b5rRs5ZbLEdP5DyLRAhT8evT PF3GDnLvpXjwKbr6JGecIF2r5BwM6Q0LUiR/YTFHgQlmFwxJkjp2MqebbLegU2vpjkc8 NhszShjZpHxRl/Jmi1pkLbojXyt7cBdcRDdW9g7tiIft+kH39LIqOs8AoZ4lq2k3zTWL 1sk4ST6UQwfe32rcAaFH4QACLNXWDj5yat3N/yt3WX/IDO12o1ZFpcGYiTmtZJknsY3a IVPQ== X-Gm-Message-State: AOAM531JZDPGgPeRBqAEMm5fqgTGUs+6/k8C5tT1Yr7I1HE/OpeHwfj8 MzLzkdtPpxTM9jGWw2GyB9xLZ7JFC/r8nwOkjeo= X-Google-Smtp-Source: ABdhPJzcTjTlmmQdnEzAYC4y/zeNUyjAzAY+REJdX/vK/J+OVPyc4sDFCIkK9GVuPk/uNanPkBQncQ== X-Received: by 2002:a2e:b5d8:: with SMTP id g24mr6094104ljn.64.1617293557129; Thu, 01 Apr 2021 09:12:37 -0700 (PDT) Received: from 192.168.1.8 ([212.59.242.58]) by smtp.gmail.com with ESMTPSA id l10sm586356lfk.48.2021.04.01.09.12.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Apr 2021 09:12:36 -0700 (PDT) From: Maciej Falkowski To: khilman@kernel.org, aaro.koskinen@iki.fi, tony@atomide.com, linux@armlinux.org.uk Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, maciej.falkowski9@gmail.com Subject: [PATCH] ARM: OMAP: Fix use of possibly uninitialized irq variable Date: Thu, 1 Apr 2021 18:11:27 +0200 Message-Id: <20210401161127.8942-1-maciej.falkowski9@gmail.com> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210401_171241_941392_882A60E2 X-CRM114-Status: GOOD ( 14.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The current control flow of IRQ number assignment to `irq` variable allows a request of IRQ of unspecified value, generating a warning under Clang compilation with omap1_defconfig on linux-next: arch/arm/mach-omap1/pm.c:656:11: warning: variable 'irq' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] else if (cpu_is_omap16xx()) ^~~~~~~~~~~~~~~~~ ./arch/arm/mach-omap1/include/mach/soc.h:123:30: note: expanded from macro 'cpu_is_omap16xx' ^~~~~~~~~~~~~ arch/arm/mach-omap1/pm.c:658:18: note: uninitialized use occurs here if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup", ^~~ arch/arm/mach-omap1/pm.c:656:7: note: remove the 'if' if its condition is always true else if (cpu_is_omap16xx()) ^~~~~~~~~~~~~~~~~~~~~~ arch/arm/mach-omap1/pm.c:611:9: note: initialize the variable 'irq' to silence this warning int irq; ^ = 0 1 warning generated. The patch provides a default value to the `irq` variable along with a validity check. Signed-off-by: Maciej Falkowski Link: https://github.com/ClangBuiltLinux/linux/issues/1324 --- arch/arm/mach-omap1/pm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c index 2c1e2b32b9b3..a745d64d4699 100644 --- a/arch/arm/mach-omap1/pm.c +++ b/arch/arm/mach-omap1/pm.c @@ -655,9 +655,13 @@ static int __init omap_pm_init(void) irq = INT_7XX_WAKE_UP_REQ; else if (cpu_is_omap16xx()) irq = INT_1610_WAKE_UP_REQ; - if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup", - NULL)) - pr_err("Failed to request irq %d (peripheral wakeup)\n", irq); + else + irq = -1; + + if (irq >= 0) { + if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup", NULL)) + pr_err("Failed to request irq %d (peripheral wakeup)\n", irq); + } /* Program new power ramp-up time * (0 for most boards since we don't lower voltage when in deep sleep) -- 2.26.3 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel