Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3091954rwb; Mon, 15 Aug 2022 17:56:00 -0700 (PDT) X-Google-Smtp-Source: AA6agR71uoep3oLJ3U+VT6wSjAX02TVgVEyMdZAHuIm5qGa2Qbrpzg8id1RdWz2tCqfp5Cmtdq9x X-Received: by 2002:aa7:d88a:0:b0:440:916e:706d with SMTP id u10-20020aa7d88a000000b00440916e706dmr16140468edq.167.1660611360499; Mon, 15 Aug 2022 17:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611360; cv=none; d=google.com; s=arc-20160816; b=ZTpYxO6erketmNH68ARMuVMH27pfGivDamIQDvKOmESUtwEJPJd5QC+6JC2S265brF jExVLi7M0g0oYE4/r7vLvRyiXmnm9NGeCBMRPgS09ItTAD5ca0f2p8wV3Kyj8XwzfG+T /1w5OVRqwgERYyJIII5eL/PDb+wwcOYyPjXV5gb6Ot+OEZyuOijdDOrvrTi7L8MLahyi IkajqtLa0mKBgp3k2rfYJ8irc8CinXnhjktZPr9Bl6ZlmDBAJz0pAFx8Trpqa9j4ThpQ ZsYpkNX7jiTkEtsYEtxYcjYRcMe1gIZjaE3cyBwanKM6RSFn0sxznQ9bkfHrLgEtGG2b vteA== 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=h9UAnWP6n2nOy9manGmA8UjxB6npLb1boJXQOfnuv2M=; b=f2TyhXTGCI/UuQlzawfWnP1ksnzMBUir44Tp97i7xX+tp6mlQfHLdcwtUMZ0zUTaM+ dTIHvIWpc/fL6YHpSehWPUfQOPiRhm4bdv2/Umcl1eFHHa+5C6HuIf9WGTmLGVIjlgjz FTVKsL5pZ/Zskq4i33joa6HP9ZQJ41rHkeBL4IM0Eyd7BVSqC+LFsRNQSqLfBLUO3+WE 1d8uYVmJNwRN25pmq+R2CqyCkPtDdQO9kveACkJUXoozcEMAKYnOx0GvLaGkDHlfpKQ/ 0WNBuFljMMHxSrMwoQN0gTDvfK+8dDJuGZC9idvP+20ym88J5LvNn+rDgG2kod9l6JYF hAlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hooO9W6l; 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 f5-20020a056402194500b00443e3fe7ca2si1697109edz.263.2022.08.15.17.55.34; Mon, 15 Aug 2022 17:56:00 -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=hooO9W6l; 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 S1356467AbiHPACZ (ORCPT + 99 others); Mon, 15 Aug 2022 20:02:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356517AbiHOXyh (ORCPT ); Mon, 15 Aug 2022 19:54:37 -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 9D25C161023; Mon, 15 Aug 2022 13:19:20 -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 05378B80EA8; Mon, 15 Aug 2022 20:19:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 441DEC433D6; Mon, 15 Aug 2022 20:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594758; bh=5dRDNXs/QgWfuYDBCunq03LMa1ikBn4eqms4ZiKwh7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hooO9W6lMa1joUZ4tPmPR84LVY7PG4TKzU/6yiuje75W3Bbtxay55G0JlDQl+Bixm WX47hOxyLJWXu0EhQd/Vk76sm1zLcJ0gGfnt0q5x2YEVejBQzLMIh4cmasovhBCuSY /6Om68CG99YzVLesK+0UvHDYvbijgY9y2HAPYcwI= 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.19 0518/1157] can: sja1000: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 19:57:54 +0200 Message-Id: <20220815180500.430771271@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 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 2e7638f98cf1..84adf8b5945e 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c @@ -402,9 +402,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"); @@ -426,6 +423,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