Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2927158rwb; Mon, 15 Aug 2022 14:12:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR4bM8qujzQgv2IrXvQQU200uIwLlPnvpLODaMJgFEL0/SsduA78voalRqZ88/wyPQNdbxHz X-Received: by 2002:a17:907:b590:b0:730:9e0f:e9a3 with SMTP id qx16-20020a170907b59000b007309e0fe9a3mr11149841ejc.112.1660597954531; Mon, 15 Aug 2022 14:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597954; cv=none; d=google.com; s=arc-20160816; b=R/a6De7d4iqBJG7stjq2+o7me2zEC7yLsqxnlzDCpRDQ4zI7srTGHihRMdzsFkEWou 2Iuprl4qsNmKwfHmKqSdj5B0UtOxmt7+M0F4sk0BXimzd7zWkl89TPB6VCfHNfpvImZt kVcyt3zFn0NZgD9+OvTX/0H0pjFcZuSPkQ3FmAPaTzHSEgE1nssIQceaHRfMKGvOcn6T O0sGLc8niKlCMhEzOFqv+dtVSeObQGTZZ8dvVgmZQP9a/kpJrgGPA9ALauUHDtqZB3E7 IedOgJv6VP/GG7/n0tkRoLKeQMfPA1E99p3Q+i9koxnzSG5P4qO/nO3s2Mcz86BNi7RH W85w== 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=U94Q8J+c2JR1pz+8rt09k6oSFqDhv2hBLUi6tXMsCAo=; b=t59Xjv2QEOHUM9fLJMYj8anV2MELyEfznAWlQmzKMcbdBOnokZ7Z7a79l7YPsL0H/2 ubkOj7TJJbFudIUHT9Fpu1Uv/8uExrqVNqEAnMkz4clXLCJHKhA3cAUm4YAcosDafmQx PiMPuc55w6fyPDjL5ouXbSWLEVa7SkVxz76SjYAjHKh409HWa6bjYFppQG+71dwljwVW F7RTyQw5B7hQO9mTDUIEXpAD+dXMV5kQ7S44u8eRnRZqjsTlA5a1KuMGeKTPPr+3RE2x ZbQzilAdCiqGD6XOCcNxvHs1DFlda3e5k7mkWNCVu2pNGss49S70HTiFYvHsTu/sXcqO rIfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=I5qyrZFf; 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 dz21-20020a0564021d5500b004419b8cac8fsi9924622edb.509.2022.08.15.14.12.09; Mon, 15 Aug 2022 14:12:34 -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=I5qyrZFf; 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 S244935AbiHOTAD (ORCPT + 99 others); Mon, 15 Aug 2022 15:00:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245070AbiHOS4h (ORCPT ); Mon, 15 Aug 2022 14:56:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F501326C8; Mon, 15 Aug 2022 11:31:28 -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 AF0AD61029; Mon, 15 Aug 2022 18:31:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A430DC433C1; Mon, 15 Aug 2022 18:31:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588287; bh=SUa8h2m6mypWO7doBPbdoMm7YnhVBnsmn1EZLZBxgRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I5qyrZFftOzc6uhPh/wTRdMFU7lVeHg9rgn1j6KvzfbY4eOWSciZZQmogc3eBoeRr WKE99Prz9gN0+OFA6gvhXUE8YCKmGFrUxTLdLn15Ud4NRoIAggp54GHEKwme9Oq2De xIOf3QdGOkAckB16JfcxUlFEmssNdcd1deEdU9BI= 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.15 353/779] can: sja1000: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 19:59:57 +0200 Message-Id: <20220815180352.335672612@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 3fad54646746..aae2677e24f9 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c @@ -404,9 +404,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"); @@ -428,6 +425,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