Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1863515rwb; Fri, 19 Aug 2022 10:38:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR7kPm4kp6dGeqydp7yMeXjdHHlNlhujfy9irGy1BL1MM0IZrBK97Mg37akTCckEZf4KFR4y X-Received: by 2002:a17:90a:a406:b0:1fa:da13:549e with SMTP id y6-20020a17090aa40600b001fada13549emr5932016pjp.182.1660930709267; Fri, 19 Aug 2022 10:38:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930709; cv=none; d=google.com; s=arc-20160816; b=HIVfZmyh7MCucdccVbVQsjIJekNgqeIFgzoAO60BZgIRhgCSkCAWA1Hlste7NfnofO +e8AYQmOLkGj4jYf+NAPSIHWb0W3ySyApFEjRpMTZdqw0tIuMUWDq750tw2SMMH/OQ3t zmiMF2dFC3CG59lyItlbFu7StlgNzu76mOa9OrD1LWMQD0BPr9C7GlsSPllO1nZst/rW FZ2d1nddBsz8Ft0wFrzLCVkWZ0pMhMIBZINU9rBmsiNy4anQBW5kkJaMSHMuC5wgcGaM cQas88uKl1A2yf1IAXs9KJft7+Oid7ikS5K4pnzhjYTp9sdIJI25FTZF3WELa4Zs0KNs Bdeg== 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=Pff638dkvaznpPUsczPegZDL8pDdShTHQ0XRWyvfgDc=; b=VDIknYqzRaxKA3mtA7gJwwRaKnJIKywm7kQjf7hmQnIT108HZCFqGJfvU2GRgKQ9Pa spOVSiJ8vVsjQuD7IyLEzCKmenhALI3HTS3smqrOXK1424U19OPYpwchTnfviWoVYCdc qPXMOBYK/JaI7Ws66O78pdgv5UIsjTsOG3qPiJQmII/2tG1+qnqiNJq0SxfZAMvpJFmZ i+VtDFUBTf54HqjqrPB2qQ6XzhI/EVgBQ+AgLzhQa+88PCy97FgwaOk0Nu6UxCzV9AuE ThjMnfYGHqlSG/TtcK1C46yuC/xqDoDt8S8z80gwfhUwiEYXJpfrJ+fhltMQUFgKoRJR WHMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LgFWovI8; 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 t20-20020a170902e1d400b0017283063df2si3901536pla.334.2022.08.19.10.38.18; Fri, 19 Aug 2022 10:38:29 -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=LgFWovI8; 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 S1351913AbiHSQOF (ORCPT + 99 others); Fri, 19 Aug 2022 12:14:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351908AbiHSQNF (ORCPT ); Fri, 19 Aug 2022 12:13:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE3F8113DEB; Fri, 19 Aug 2022 08:57:30 -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 767B36175A; Fri, 19 Aug 2022 15:57:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B5B8C433D7; Fri, 19 Aug 2022 15:57:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924647; bh=C20kY/76P5H8HT4Qrw53JiiCX9u/VVZ87JzsX7xoyNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LgFWovI8+jBVLHKSutQwl3Rcbt8CkMMufMeg/meGyOUjMBgxOM/J+2T0LqbmeQSyH 453e8+yqGV80WOOzvzKMoQeEfOwzDBv+Y2S0MT6PZe/ZhgJX8+MOH0HmudbRXotRjk 57is+2T8UQyuUuYLh33C9KHVPvpseADPX70ETDxU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.10 237/545] can: sja1000: do not report txerr and rxerr during bus-off Date: Fri, 19 Aug 2022 17:40:07 +0200 Message-Id: <20220819153839.960157137@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@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 164d7cb2d5a30f1b3a5ab4fab1a27731fb1494a8 ] During bus off, the error count is greater than 255 and can not fit in a u8. Fixes: 215db1856e83 ("can: sja1000: Consolidate and unify state change handling") Link: https://lore.kernel.org/all/20220719143550.3681-4-mailhol.vincent@wanadoo.fr Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- drivers/net/can/sja1000/sja1000.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c index 25a4d7d0b349..ee34baeb2afe 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c @@ -405,9 +405,6 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) txerr = priv->read_reg(priv, SJA1000_TXERR); rxerr = priv->read_reg(priv, SJA1000_RXERR); - cf->data[6] = txerr; - cf->data[7] = rxerr; - if (isrc & IRQ_DOI) { /* data overrun interrupt */ netdev_dbg(dev, "data overrun interrupt\n"); @@ -429,6 +426,10 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) else state = CAN_STATE_ERROR_ACTIVE; } + if (state != CAN_STATE_BUS_OFF) { + cf->data[6] = txerr; + cf->data[7] = rxerr; + } if (isrc & IRQ_BEI) { /* bus error interrupt */ priv->can.can_stats.bus_error++; -- 2.35.1