Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3474326rwa; Tue, 23 Aug 2022 05:28:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR7HZ/sECNg5kNQfdWN8ARFdzttXk6GWqpJ+BreUiKWGUESfinO66RxzqKvf4KQ9D5bBECfW X-Received: by 2002:a05:6a00:2449:b0:528:3a29:e79d with SMTP id d9-20020a056a00244900b005283a29e79dmr25464716pfj.39.1661257730168; Tue, 23 Aug 2022 05:28:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661257730; cv=none; d=google.com; s=arc-20160816; b=mmJMADNy5/qrJQp2rV+ObhoyPxvBKThWUgoSh76Awb64SIdlp9X4J0VuiaQrTKNoXV scabgxAEfwUlKUV9syNnKQ4mEl33gyOak2AOpOGD1qEIKcWwSGWz+i5evbC5YENQ0hu2 TtJ8j5xDxh2DJp1zjdt1sCrAK24xcTGCLjiDgzLElrn6etvE1JdsWFYaVnasm8GGgeJc Uw68M+tvtk0JuiZECoEPfGn4wvF8tE/+l8TLiPRthMHcH/6vwcY0Zl592O/YX8C8e37g SEHeLgZun+IkcvGHqW1gyQHqxkHtmEo1VtHZgBtaZ2sOXJtJtptR3wJe9Uhg9Rzm1GXy toBg== 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=GR7OlMIdfE7oLDGqAngx2YB3ixHI4szKIhfhpRFlbfPB6ZUWFynD8crHNSBjncXuq6 d3W0LylJhVlcl4PnC0x2ZjGjYJ8PIv1fLf3Wa9NceqSocyY1KerB906xhfrhkdUOT63S 8E7xpx8NXAnj9HPKwkeIJuYNXZDNI5HtgMNlYh/5Hd5e6PK1DzNAUEJbwjzGhIhHOHgp JDkoHPM31i3nle8SA192bj4frKhw3GE0XankvzG9UbYTKUihfIfbrrjHN4B1l3elxwug bxS2z02lFOIUKCzzOBd47GcS4sAsGjbCQpzlFySYzN+9G1f5y+mXnkCQSwdBFmoF2CAe 0obg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dqTysVFS; 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 s16-20020aa78d50000000b0052ab37ed70asi2776661pfe.57.2022.08.23.05.28.38; Tue, 23 Aug 2022 05:28:50 -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=dqTysVFS; 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 S1355729AbiHWKkm (ORCPT + 99 others); Tue, 23 Aug 2022 06:40:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354460AbiHWKZk (ORCPT ); Tue, 23 Aug 2022 06:25:40 -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 F144074CF5; Tue, 23 Aug 2022 02:05:08 -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 7CC5B61580; Tue, 23 Aug 2022 09:05:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83150C433D6; Tue, 23 Aug 2022 09:05:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245507; bh=yO/+0w+QZpL9FyWrE4hrpJ2hjLScgiQtI3GR94o+23I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dqTysVFS9GsNmb9fDFAQNz1xJ6toxRJv9B6sx4vYT+H1hmt1NXsg2eExK+gE/GBbY UDxyNtJEzwMtZM04XgknCXc0csV0MvtBZRhYIJGwRHz8GNp9rYSi3KBoxkG8/WylBb 5+Y6+LtAbRaxw3aIBUlcoG1diHQIxjmkbKS+N/kY= 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 4.19 099/287] can: kvaser_usb_hydra: do not report txerr and rxerr during bus-off Date: Tue, 23 Aug 2022 10:24:28 +0200 Message-Id: <20220823080103.689257494@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 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