Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp748276pxf; Thu, 1 Apr 2021 12:30:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUqcGnlr5mNnmpGbkcOvHFSvmcmO/glfnh5ET8t75hBxGHcOwsqSrZJ4ZbE2KjC9xGAFB7 X-Received: by 2002:a02:9048:: with SMTP id y8mr9380972jaf.66.1617305400648; Thu, 01 Apr 2021 12:30:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617305400; cv=none; d=google.com; s=arc-20160816; b=0XgKI22ZaX8AYLglbu3A/cuJWbmgjyQWLJAGcwU5WKQT/Iq9weIvqMSyVRUW7kvjWL g1F/BimrXpPCeSp2f8dlSx9iHPO2RS7TQ7OgzdvyuOQOQfeQSAiYXmLu3xyNU8gjd516 n4Nf28P0mEEGrfpJ8ZBv6TBRvvRawXt0g7lUXNhFKPrk1dgQtnG325Ccbsca5lsvE8KC w/mxLk3A6yPPoSVKuGyH3co2P9Hu1BjzLqyKjQC5Jt20i56cAiTq5Jik3hRvQ2Vp7doa fmFQRjumYSSkYu7Hc+DvHtmSCfKaFjCXkdzPOuRAtVoia8z+mt1s4KyBs1cxAt44hxV1 Xb3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=DNNEGx7A8yGFZ03tYjwr9iyeGvfeQ20XIzLEait0s70=; b=eTqIRRsuStH01kwJuSnchc1+zvfTjZEISzz2kQ3Q3t3WlcRxfz5gkOY0o09V5hgSvW pmdwgambvV/MsDHXzRXwygiXF/UuzEa3FjXhhwz+ZVMwm8Z8SHLgNuNRC6S+isUru0FY JGFP9XnmlJtsKeQLF8dE46Ub10FlpTWYSqxfgmQeJEWJuSHFyukPQy4EpLuH2MiXt3Ng YvYpAxN/GBCFLDb9o8G+SuqDv/4XSJox6q2PIeWCm06rEVmv9uKTjD7ar10393Qt42uf eIdTv6wBPquZDiA0k1/Gax8n5eHgUeMyuAxRXtH4cTM8R1uscI5e9yvzWiTEFWwbKL/9 r9fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=QdVoyrhh; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p28si5250195jal.45.2021.04.01.12.29.46; Thu, 01 Apr 2021 12:30:00 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=QdVoyrhh; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234600AbhDAT1u (ORCPT + 99 others); Thu, 1 Apr 2021 15:27:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234959AbhDAT1k (ORCPT ); Thu, 1 Apr 2021 15:27:40 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7F2AC03D206 for ; Thu, 1 Apr 2021 12:06:06 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id g8so4341833lfv.12 for ; Thu, 01 Apr 2021 12:06:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DNNEGx7A8yGFZ03tYjwr9iyeGvfeQ20XIzLEait0s70=; b=QdVoyrhhfbDEFqnPYd9w4ehNfmf+FjnOe9vuh1ECpZjh4u8A2geVILkm+LOXR76MUv aDaWPbbdGQ8as9RLCzdBMzdKAeAQuy+QYSFlptzE/7GSNNVav3REeTmGSvCShaDkCPe1 xaphaeO+zk4yx/WziudmaNHwePNXdkuDzaXK8ndzAgOm4C9AyxGC7TJ3lcyMlPjy4lnT 9WXKXl2eOZO3IaTGztvDWDLj83XhhoZOacpxEmjDDmRitjLzaSvwyI4efC8kW5yeZY2t +1+33vm/80LAw8q18kME3zeGlQX1uVhaOSWWcPi3+R/0lVOt9fmMrWz31MzYH25uo9nj 2O+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DNNEGx7A8yGFZ03tYjwr9iyeGvfeQ20XIzLEait0s70=; b=Q2hYPdrv3swuUzu3V+WeIfWWbLCNUd4jO0anVnuDMxZaIJnubjTRB1krt/5He56EkC +1+iIb4vjzfl/RTfLp1K+iLMoxj2+zWlqWuSwIsbsgUCz+477fv0QBd/N62vkfEfh2gc FYKuhx8GjTwai5E9utnspKdYzdr5VOaH/UC1pHUJTBvKuXUHAvxP3PPQ3XGvadYqlzNu 7bTNT4nIf8rqmJcXO2/b6m88WL6cQOV4ZqbdARx1VDKykfocpbswoT2qLsGbXFc1phlI HQIa6JW4HWVrLoafCEVR0vhS1grtISpOBP4ZDxQgWEUnGnRbOTFY8UuhkvmZ8x55ReOr ytsg== X-Gm-Message-State: AOAM532d9ShwO8lIM+8UryA84svzpeebd257+STsF04bS+tctYEmkyuW Z1CIqD2uhgbOPj/1DfgVj856RqM5GNL5cafKH8PFeQ== X-Received: by 2002:ac2:538e:: with SMTP id g14mr6217538lfh.543.1617303965137; Thu, 01 Apr 2021 12:06:05 -0700 (PDT) MIME-Version: 1.0 References: <20210401161127.8942-1-maciej.falkowski9@gmail.com> In-Reply-To: <20210401161127.8942-1-maciej.falkowski9@gmail.com> From: Nick Desaulniers Date: Thu, 1 Apr 2021 12:05:53 -0700 Message-ID: Subject: Re: [PATCH] ARM: OMAP: Fix use of possibly uninitialized irq variable To: Maciej Falkowski Cc: khilman@kernel.org, aaro.koskinen@iki.fi, tony@atomide.com, Russell King , linux-omap@vger.kernel.org, Linux ARM , LKML , clang-built-linux Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 1, 2021 at 9:12 AM Maciej Falkowski wrote: > > 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. Ooh, yeah if cpu_is_omap15xx() then irq is unused uninitialized; I don't see any INT_1610_WAKE_UP_REQ-equlivalent for INT_15XX_WAKE_UP_REQ. Ok, LGTM. Reviewed-by: Nick Desaulniers I agree with Nathan on the Fixes tag. > > 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) > -- -- Thanks, ~Nick Desaulniers