Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3222648rwb; Mon, 15 Aug 2022 21:32:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR6YWuaE0B/fgtwc6sAlf7dP26ywGtkjNs/PlZEta+tdp1NO7Z+5qNhNjifrqd7grTF3f4QT X-Received: by 2002:a17:907:94d2:b0:730:87c1:e86c with SMTP id dn18-20020a17090794d200b0073087c1e86cmr12333374ejc.129.1660624357042; Mon, 15 Aug 2022 21:32:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660624357; cv=none; d=google.com; s=arc-20160816; b=bbrbCTj9GsGugCCYSa5RCZxD9biFta2WR0eVtkA0L4jz2fVuJOdguIF9/kVDwOrBc3 k5JfkngR+jVkZfIDTyvyrf10KF5kDSSYQc/rI1tTUhnjgHoy0i5X/PewbFy/gM8ztgr8 vm1RDX/vzFnJH3D9slqS42eKxRptH2icz7Zx2vO9/0bdPHEgO3QDTA9o/d/575GsGI3Z vYhPilIuVKZtLPhcTMGi+SALLYWEAt6XbdGuNYGPfEDmQwAknKSFOh2fFfLmn9XdqsuW FNtf/emJby3iMNvfz0ZQE9b0axl2LQxGBOKpWPA2gxHCm9RBWAKGOvpJIybAnsepfugl v+DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uNlakDEFM/WptRaAGIkx0d+lU5U6juvg8tpdC49rmcg=; b=Frf8kFAMof5x+2Dzdj614/KjXhfG1yowExpuC/C+QhEAkDUhSHoEDlTXXBbmdC4f95 LkUnJImhVUcGVnpyXv19ujll34nwD9NH8FnGsne8D+iVzakdvL3TvJccHUcgr53oo04M 6atmF7BFWfPvqJDb69OhporKUBjmxrFuclhdYi4a45pfe+uehZXJwbgiATScuXntPzfH wKqO+Yk/8+jB8Ot1R1Viapp0kKnS35T6bUaMyX7IevvZ/XleP3xJnaY0yEw/Cu70Yz6U WsWrGFAF9aB2DcnqInHhWNh9rPWFmVCK9Im20sMYJcTJl/3mV2PzccLxbG8eiJiSA/ao 8K/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k2mk6j5J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c11-20020a05640227cb00b0043d556dd041si10129626ede.446.2022.08.15.21.32.11; Mon, 15 Aug 2022 21:32:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k2mk6j5J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229785AbiHPEah (ORCPT + 99 others); Tue, 16 Aug 2022 00:30:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229592AbiHPEaP (ORCPT ); Tue, 16 Aug 2022 00:30:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96ADADA0; Mon, 15 Aug 2022 13:18:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2D67560FB1; Mon, 15 Aug 2022 20:18:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C01BC433D6; Mon, 15 Aug 2022 20:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594683; bh=D8FrTblURfi36PKWEA+ZdsCxsplpYP106ImTq2/KnAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k2mk6j5JYQGxOz0nEhkQDoMQqjEIS9f+X5w9Ii3aLFx2fkrfVq30uQ8EV/+6duaBD R9N4CXmu/NYHjH0AqNLCL8Ge0pCXtVSqn943zomAK7KFPhXhMq55p+cKMeZrtgfgor 42rziPWLOrQZFzktG8C0L5mBAx308Sh5PFeliUNQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.19 0526/1157] can: pch_can: pch_can_error(): initialize errc before using it Date: Mon, 15 Aug 2022 19:58:02 +0200 Message-Id: <20220815180500.705195453@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vincent Mailhol [ Upstream commit 9950f11211331180269867aef848c7cf56861742 ] After commit 3a5c7e4611dd, the variable errc is accessed before being initialized, c.f. below W=2 warning: | In function 'pch_can_error', | inlined from 'pch_can_poll' at drivers/net/can/pch_can.c:739:4: | drivers/net/can/pch_can.c:501:29: warning: 'errc' may be used uninitialized [-Wmaybe-uninitialized] | 501 | cf->data[6] = errc & PCH_TEC; | | ^ | drivers/net/can/pch_can.c: In function 'pch_can_poll': | drivers/net/can/pch_can.c:484:13: note: 'errc' was declared here | 484 | u32 errc, lec; | | ^~~~ Moving errc initialization up solves this issue. Fixes: 3a5c7e4611dd ("can: pch_can: do not report txerr and rxerr during bus-off") Reported-by: Nathan Chancellor Signed-off-by: Vincent Mailhol Reviewed-by: Nathan Chancellor Link: https://lore.kernel.org/all/20220721160032.9348-1-mailhol.vincent@wanadoo.fr Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- drivers/net/can/pch_can.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c index 497ef77340ea..f1afab4f8a27 100644 --- a/drivers/net/can/pch_can.c +++ b/drivers/net/can/pch_can.c @@ -489,6 +489,7 @@ static void pch_can_error(struct net_device *ndev, u32 status) if (!skb) return; + errc = ioread32(&priv->regs->errc); if (status & PCH_BUS_OFF) { pch_can_set_tx_all(priv, 0); pch_can_set_rx_all(priv, 0); @@ -501,7 +502,6 @@ static void pch_can_error(struct net_device *ndev, u32 status) cf->data[7] = (errc & PCH_REC) >> 8; } - errc = ioread32(&priv->regs->errc); /* Warning interrupt. */ if (status & PCH_EWARN) { state = CAN_STATE_ERROR_WARNING; -- 2.35.1