Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1864901rwb; Fri, 19 Aug 2022 10:39:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR7WFsr1gwBrvKRKizJRgtpR2Xk3TRQudoMsVjb5LmHWJFIJ6YknONGKrtSIsmehNHrR2h5S X-Received: by 2002:a17:902:dac9:b0:172:af95:2db4 with SMTP id q9-20020a170902dac900b00172af952db4mr8501731plx.70.1660930797737; Fri, 19 Aug 2022 10:39:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930797; cv=none; d=google.com; s=arc-20160816; b=LDwWhHIFJ/mbLD8F1OO45jL6l8BZ1u6qeod2rCJWJCB4gIgv+nVdRh1SiLBmcvCVEJ hVnIfApyZLGtdCXG5yQR9o6t3r7nQtwi/lJChBCewgqz3gef0HKV69bSSsC67uKGskMZ Za+JYkRDm4oBzPl0JLTS3XBBqvQ+rFWqepYMbpq9i4op5YpqNjhVLPhuC7W4Xl4FFNMI yJAE/WO1t7qm2cJiYzgDbJLpbAeEmcJ3Lonq4AEOIVQMcQeDs9P1+G2/XRaMWHQua6M+ bc2Fnz6A/8mZDwGDgDTKi1waL7znLBClQi7ZG6+GLI+UqTF1AmXAHNbCf+U1wD91Eo8l tb+A== 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=n5fEz3I5MQzirbynfHR4dugh1z2AwZMH9UZeNOipCzA=; b=TyvtFWULjGqeC5aIvvqC4pU72Vi5BHKBhlvWZqUJdGdE+pX8uXjvG6azS2aTnWpfM/ wR6rNt4fPtsEp3pPiGBte7LhNvhXVEeCO9SzMgAzGxmrmGuTznaHOLNIkDZ/xLXMJjjI SuOySAW3C+N7ppoSZEO2kFV40NZEjhbvkU7ZInebmHgQU5hFn801zTbxDwAKf8re+/GL b5xks9iRwnpnbsWUpYwqzYRWd8XPFgs5rTxEa4NvGDbg7IO1YzXUeNt9yPV1qF3ZBK1G gi+q7XiUgDlZgshWtrNj+ITs3vMdfi4yXqWO51DmC5jpJ9QiWaHpmeVza7dnnIPvIsh4 ma+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Sd7jC4iJ; 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 83-20020a630256000000b0042a67d82fdbsi630033pgc.576.2022.08.19.10.39.46; Fri, 19 Aug 2022 10:39:57 -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=Sd7jC4iJ; 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 S1351907AbiHSQOA (ORCPT + 99 others); Fri, 19 Aug 2022 12:14:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351895AbiHSQNC (ORCPT ); Fri, 19 Aug 2022 12:13:02 -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 A9DBC114A48; Fri, 19 Aug 2022 08:57:40 -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 51F81B82819; Fri, 19 Aug 2022 15:57:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3B34C433C1; Fri, 19 Aug 2022 15:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924657; bh=yO/+0w+QZpL9FyWrE4hrpJ2hjLScgiQtI3GR94o+23I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sd7jC4iJ41j4zgPxZLV9pIGETA3X9qwqpgC33lnQ70fPjc3cqrs7LXqnKW5oKxTC8 k5miXqyZwnVWmqaz6jmBRpjar7KAhNJsV6/WSPxOXtvKTMI7bVut8fp+C0lkbVI2Z5 xASpxh0bn2/LwLWTArB2tjqsVzl+/ocnDSD6iQVs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jimmy Assarsson , Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.10 240/545] can: kvaser_usb_hydra: do not report txerr and rxerr during bus-off Date: Fri, 19 Aug 2022 17:40:10 +0200 Message-Id: <20220819153840.106254159@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@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 936e90595376e64b6247c72d3ea8b8b164b7ac96 ] During bus off, the error count is greater than 255 and can not fit in a u8. Fixes: aec5fb2268b7 ("can: kvaser_usb: Add support for Kvaser USB hydra family") Link: https://lore.kernel.org/all/20220719143550.3681-8-mailhol.vincent@wanadoo.fr CC: Jimmy Assarsson Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c index a7c408acb0c0..01d4a731b579 100644 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c @@ -890,8 +890,10 @@ static void kvaser_usb_hydra_update_state(struct kvaser_usb_net_priv *priv, new_state < CAN_STATE_BUS_OFF) priv->can.can_stats.restarts++; - cf->data[6] = bec->txerr; - cf->data[7] = bec->rxerr; + if (new_state != CAN_STATE_BUS_OFF) { + cf->data[6] = bec->txerr; + cf->data[7] = bec->rxerr; + } stats = &netdev->stats; stats->rx_packets++; @@ -1045,8 +1047,10 @@ kvaser_usb_hydra_error_frame(struct kvaser_usb_net_priv *priv, shhwtstamps->hwtstamp = hwtstamp; cf->can_id |= CAN_ERR_BUSERROR; - cf->data[6] = bec.txerr; - cf->data[7] = bec.rxerr; + if (new_state != CAN_STATE_BUS_OFF) { + cf->data[6] = bec.txerr; + cf->data[7] = bec.rxerr; + } stats->rx_packets++; stats->rx_bytes += cf->can_dlc; -- 2.35.1