Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3087085rwb; Mon, 15 Aug 2022 17:48:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR5E72vSHtRV9pnB1GB+QdbnACUpCWuilhcjA81Max3ynpRf9L0NIsRbW0LlL+4O5gBteqGG X-Received: by 2002:a05:6402:28ca:b0:43b:5235:f325 with SMTP id ef10-20020a05640228ca00b0043b5235f325mr16506460edb.320.1660610934470; Mon, 15 Aug 2022 17:48:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610934; cv=none; d=google.com; s=arc-20160816; b=eTRULAkF2sBLbLDkRaZmI5cnlKyld219cj/MHULIvQa0Asz6NX/xHg2DFDf5apYyXA mgiEWU1gizQbFqrfI+FqZyoAvIiuFLX0LbOVLlUED9fROgoL0Jg0vJqJnSE7ZDx4CftJ DHvG8TFz777geLhNxT3Lih5NFm01QmdV/atYjeO4zR2QSBXD9HbyV9pQrooH8baLSt2+ FycDNIakLTACZGho45zf4XoVeJlckHpU5Y83lqvYg/YzvF+8lahDpCOxjEjRICzCqlk/ pMMN1/RBJr4O/zPohrj95iePHm58QhLQkYf0Ys40fxcB09HElTRWifpWp6C4v6YpHyU7 NfTw== 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=ons09jKNDkD5EUAkZJFpa3fRdBY6ffcErQfauG7S3Sg=; b=Xbg8MrkoUk2qGu4aTT344bzie+way6c7S8wK+rLWqRnFhfxbmxbD1ZyP61MAplDgV9 uFrnonsA+cDsL6P2FlkRLg5RG11sOTQPTJ5O+cbL/ODv/SrknoVVfF1/+4Von0aUTIXO wHxRB7KV6hkzc9yuybfxeEdL4nsggjn93SOtBxqpizP5mjyvy9+GAOc1PA1OEwu+M1h9 7qO3VzwVrVv6drv1mjG+WdsX/yHCLzewP86nUOWnGZTZSk4bar1cBPfPYCy9MlVYZb4s GPk1LxcSdsSPIMelynean0Fl6MVn0QQqUGUOH9ojv2qSXNypt/HMiFMpofjhiZiSnYIV IQQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fNLOiiIi; 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 oz11-20020a1709077d8b00b00730869f1d14si8799755ejc.778.2022.08.15.17.48.29; Mon, 15 Aug 2022 17:48:54 -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=fNLOiiIi; 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 S1356373AbiHPACT (ORCPT + 99 others); Mon, 15 Aug 2022 20:02:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356485AbiHOXyd (ORCPT ); Mon, 15 Aug 2022 19:54:33 -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 616E21617CD; Mon, 15 Aug 2022 13:19:26 -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 6623D60F9F; Mon, 15 Aug 2022 20:19:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E8D8C433B5; Mon, 15 Aug 2022 20:19:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594764; bh=uDWGoRGLRjBh6eBPt4jq0AmZj0q8f1YBxM3gr8QcAks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fNLOiiIimLD/dAz0SjhfC5kxOylBrP6ZLuEjNoZMSi11DhzPD5SvtzeMupTNcuYJ0 0c3e7lyrRSSzCVtp4CEOhhBUBxvDpeX8ej48dHlGjjQ4Yu/dpNysSRveSAMlY/gkM1 rrFxWzF3zEtOGuGtgd6WXRCQnrsF0abYqyymGpRQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.19 0520/1157] can: sun4i_can: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 19:57:56 +0200 Message-Id: <20220815180500.495015243@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 0ac15a8f661b941519379831d09bfb12271b23ee ] During bus off, the error count is greater than 255 and can not fit in a u8. Fixes: 0738eff14d81 ("can: Allwinner A10/A20 CAN Controller support - Kernel module") Link: https://lore.kernel.org/all/20220719143550.3681-7-mailhol.vincent@wanadoo.fr CC: Chen-Yu Tsai Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- drivers/net/can/sun4i_can.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/can/sun4i_can.c b/drivers/net/can/sun4i_can.c index 155b90f6c767..afe9b541f037 100644 --- a/drivers/net/can/sun4i_can.c +++ b/drivers/net/can/sun4i_can.c @@ -535,11 +535,6 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status) rxerr = (errc >> 16) & 0xFF; txerr = errc & 0xFF; - if (skb) { - cf->data[6] = txerr; - cf->data[7] = rxerr; - } - if (isrc & SUN4I_INT_DATA_OR) { /* data overrun interrupt */ netdev_dbg(dev, "data overrun interrupt\n"); @@ -570,6 +565,10 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status) else state = CAN_STATE_ERROR_ACTIVE; } + if (skb && state != CAN_STATE_BUS_OFF) { + cf->data[6] = txerr; + cf->data[7] = rxerr; + } if (isrc & SUN4I_INT_BUS_ERR) { /* bus error interrupt */ netdev_dbg(dev, "bus error interrupt\n"); -- 2.35.1