Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3329151rwa; Tue, 23 Aug 2022 02:58:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR6CZ8ytsFs6ENfO52M8efeMVc+LOr5COzoQGTQfy/NElSpHCP6a63yAV/Ch2H2RJ4gYvqYx X-Received: by 2002:a05:6402:332:b0:446:3427:5c62 with SMTP id q18-20020a056402033200b0044634275c62mr3045484edw.141.1661248738739; Tue, 23 Aug 2022 02:58:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661248738; cv=none; d=google.com; s=arc-20160816; b=c6zkE4pIcgxF6LbNkTmN85Yyngl9ZjBub28P4vP/nmR1ST5bUdQkshtI4XSEnwvCyd SrxSkH6OaZZaXxdsDDX+55Es546OTXHR3FAu0CFYqpBmD20gQSU/Fn4osCaikmODzpXO J1z1//hs2m7M2lwyRb4s9nfd2yAPmb2V4xQK9Tu9cGQnt7Lfzhdtb9I5wbwZv4NNJGJu kMLn+OnxpYYyG5j7SNTpm2PHvxCpcoVo4Ed1RBMkg/61mkMqNr5bz5n0wazRReNiX9E9 vsHNLyfDutYDrlmf0TeJ9RmO6Hdua5E9L3dxdXxGD7GaHB6UbEOIkSIAwNcZBvRZPMTy eGew== 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=ZPFG+uxJStPGbAul4fqEhzrfvFoHP0DOALrE9yp7Kao=; b=oNfDYnboQkvurY1zWXqTaF/o02AXhabhw34bce+YCgrmw9U+BstQOmCu7jslj9N9LP QegcSHelyY8jxn6hoKdyH0tjSz3/uCAH5OIvdxqNtKKKdHeJoxNFmuhYc4bMDigSUwGt rREiJk+AmRDZ1jlTTa5Q5bSEE7ea34PuJyd+eO5Dc6TEYLNYqUXfzO/9Yp1l5f7eMjhi uVZN5sCpTiDAC6jZNoRO/AEyToxCJZ5TVXVSvKZQSW3sPGzhlF8F7g9Qasjd1XRK+1B4 /cuJTN0JEhA+Q9zGUFHat7PLZzHXPNGTjaXadmRCIuC+mj+7Ao7h7NIAdMjKrfTW/MNV RESQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nShx6J9i; 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 o7-20020a50c907000000b00446090a70f0si1654402edh.488.2022.08.23.02.58.31; Tue, 23 Aug 2022 02:58:58 -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=nShx6J9i; 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 S238721AbiHWJng (ORCPT + 99 others); Tue, 23 Aug 2022 05:43:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352039AbiHWJkw (ORCPT ); Tue, 23 Aug 2022 05:40:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB68379609; Tue, 23 Aug 2022 01:41:51 -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 ams.source.kernel.org (Postfix) with ESMTPS id 0627AB81C6D; Tue, 23 Aug 2022 08:41:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67B70C433C1; Tue, 23 Aug 2022 08:41:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244101; bh=64nKZ5znMBqSE8mOqK0YmZCrB6CaXZ+9XWMHssYQUJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nShx6J9iYMSPdEO7SocxFXpYNDtyTny3BmK32K4LkUIpLpfuVLnK7vi/hP/cM8PZu RQP1+ZN6ebLlSWJkvEGlo1lufdivCgmzBcyGwT8u58PTjlTj5BHNhj1eLf7+kJcB+o hna/kLasZXNemwp0QddAFMMnJy2VvBs8MNTWtFGI= 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 4.14 086/229] can: pch_can: pch_can_error(): initialize errc before using it Date: Tue, 23 Aug 2022 10:24:07 +0200 Message-Id: <20220823080056.793489859@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080053.202747790@linuxfoundation.org> References: <20220823080053.202747790@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 3e1d71c70b0d..25def028a1dc 100644 --- a/drivers/net/can/pch_can.c +++ b/drivers/net/can/pch_can.c @@ -500,6 +500,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); @@ -512,7 +513,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