Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3016829rwb; Mon, 15 Aug 2022 16:13:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR4DohRMROHzUTsShcxY+Y4tSP4lqVlpSbcLu5dyYAEJqEav5RSuiZX6bgDfdj3N7z421unQ X-Received: by 2002:a05:6402:1943:b0:443:5ffb:b04e with SMTP id f3-20020a056402194300b004435ffbb04emr12020227edz.230.1660605197795; Mon, 15 Aug 2022 16:13:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605197; cv=none; d=google.com; s=arc-20160816; b=gF1pLgZI/tbMXloEfYHGa9f9ojFZg9qQzq++FnGJ2MWxd0gQkZEyW0IQgK0tsEY0eO w7C1OLXkrWxBn7y9SfmFQPZyhrJb2dzfa2CVOTffKTiXxNbk6QIQlXSY64JnNuCYEIqc SET0LmET0yjo3KyTNNPvvvascdObr/fEDm4QQAlLVUELkYqO7DldQH8UBRjaY7lobn+U DpBEWnQAowGNNSjJq+ngn2UwccJdj7LjQW6qaidlh8+dpfgFGLAiTrkXW5s0lL29bov3 K5WtWPEGMbksQiedD6/kE6P6l3aUYQvmed3Uo964p1tlrsOptKdfIJtrMEcGpwx4HB2L soPQ== 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=cV0lkFinfT+DLSnYUkIVMMLDqiAyIZ09WCzj8s/zdUw=; b=GWir9Zv5s4ZGkf3OdJiKLSaRvmDnMgGb3kCv3nb2KTCvy8BSvaPnrhpsEdDmLJhY2l h6aE9ZNGCiBqV56lDTlWDo4UJlAPw0JbSZ8GIOHgbE1JVK58n66taiRhdzudBACRQmF7 EeBTjYs0w7Nk/SOdL7Om6i9+dIMgg/g6K1TTlVcsj14e/e3++M3aChplkzXhnmCeJ4Nk RrkOxIP+Cxxt5h1vA7tvjkuzTllE8v+eY2R//iqJc3Vtrws4pjSWwMJ+i8dUpAuDiwNm 9Q2AXnllgt6tBbcsZYTrkZB8B5Ag5HVo171IPDo+F7Fa7yAMMgFBkarN8dlIzvNawAqZ GhCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D91yuvuP; 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 ds1-20020a170907724100b00731148bc546si10031976ejc.38.2022.08.15.16.12.52; Mon, 15 Aug 2022 16:13:17 -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=D91yuvuP; 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 S239742AbiHOVTB (ORCPT + 99 others); Mon, 15 Aug 2022 17:19:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245439AbiHOVLV (ORCPT ); Mon, 15 Aug 2022 17:11:21 -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 C0CFC2E68E; Mon, 15 Aug 2022 12:19:10 -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 B03D76009B; Mon, 15 Aug 2022 19:19:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7021C433D6; Mon, 15 Aug 2022 19:19:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591149; bh=bie2YhzVa1X6tTTKAxzCNdn7whSyCkG11tybkM125Sc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D91yuvuPVRhJs2PQhJAurPR8ThWnmzWul5K72y4AvjtPD6y2vFuGLVZS6h2T9vDLS fLst2tc2+V9UxC+7+bjp1a7RgXcCavwP6jHz0xhhNn2GLJd1ZkzmpuBwg3tI7npUUr xXZX+dGJ/A5e05UpHbcwvGZERbJC8Rh8if6zB7xc= 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.18 0487/1095] can: sja1000: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 19:58:06 +0200 Message-Id: <20220815180449.692349927@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 966316479485..366a369080ef 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