Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3399079rwa; Tue, 23 Aug 2022 04:15:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR7KBeGEvPU7g3Ct5Khk3FWbA32tYeCdTH5KdkZlnBRsFtzaS7BbtZCzOqD70b3H2tFwg7Ck X-Received: by 2002:a05:6a00:2192:b0:52f:6541:6819 with SMTP id h18-20020a056a00219200b0052f65416819mr24959118pfi.83.1661253309157; Tue, 23 Aug 2022 04:15:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253309; cv=none; d=google.com; s=arc-20160816; b=OJctniC9CD3CJep6VuOlnIaMC045u320rEEtj8UpKHzoTATkBm9CM2g8NlaBC8SpCZ J8LpaUiUqmB3kIB9o02jj+YCLWlMGMMaI83CZXeSOBVy3qGbVbZc2WYWCgI0IKhW7YOy EDHGXOnTHtRPkdgdEdMpDzeZdDhx60+zSEbDYel/PZevimiMShqByWvAU2RovVwheQQf aOh+VSidwOzi0DBERNYml9JdideacpL5enJRXra3aLgu9eqlC5uV5h8ltAhj9a81mH3K PdPlaLArckZXXBoxKho3/KRmVWb6Jp9xgDG9q3ybujDa0Mi4hP3UxrZus3cstL4F5VV4 J2uQ== 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=K8L/f9xojbgIlfmt0hBGdGKrjv+5V/zun2klMuygReo=; b=rEI0Q8Mf7JjB5YKwmuYFLheP82GGjBvIOCiKiSDfRedgwHYmscyUnbV0T7ryHob+xl tggBU5dOBTSfQ8NASYfiFZ7FRqJgzuMYkBtSRP9Titg4ysKfz9WadFmoJZsniZSz2cdU OZlAmLBYtHi2nGI7Os0Cbd7AzkmJJ1Q/ea0AvpYnnNb2JolOTUSirdznqm/p6xAf0ySl L0lzGP7zc4ACI4gqJkeV1zDdxarvizidyEukU1xs2dq2itENa7lZw9qCBgqpQBu9XxFv tOsm+gaC7/6KD3MW1fggolyAeMQ56oD17b+PuxEQL59uCxPoX+EIFvrP6QB84bmrtBc4 HnVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rYDMGj4w; 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 k10-20020a65464a000000b0041bc22f2e79si16147623pgr.6.2022.08.23.04.14.58; Tue, 23 Aug 2022 04:15:09 -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=rYDMGj4w; 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 S1355623AbiHWKkN (ORCPT + 99 others); Tue, 23 Aug 2022 06:40:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354357AbiHWKZ0 (ORCPT ); Tue, 23 Aug 2022 06:25:26 -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 C2288832F2; Tue, 23 Aug 2022 02:04:56 -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 5052D61585; Tue, 23 Aug 2022 09:04:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31DC8C433D6; Tue, 23 Aug 2022 09:04:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245495; bh=k6l0jTys9X4jNwGOb/WlS1JIPlY5G2K38bc4mbzN3tQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rYDMGj4wM/Mxg5aFPmUlGIK9vgpwyfdnoihRb0HIRRDP0t/V01r4u9shivlr1jC+U MCiEJI6l+f2/moKaUUPw6W4yc2dlUkks0kQMMfuzhqePZi8ZCs0wKOW4jU/ZAEMaFm g2Gr1eqNu+2R0j0HAcwqBGLDaKVQKnVeymLUl9Dw= 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 4.19 096/287] can: sja1000: do not report txerr and rxerr during bus-off Date: Tue, 23 Aug 2022 10:24:25 +0200 Message-Id: <20220823080103.582813645@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@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 9f107798f904..e7327ceabb76 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