Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2886978rwb; Mon, 15 Aug 2022 13:19:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR6R8Nc28RuqiwG2SjMCEBsc/GUw8c6Uk45AIEJLnUbd7KyTBWCCHZxUHLPMGhI9+kfaF2MC X-Received: by 2002:a17:907:1b1f:b0:72f:56db:cce9 with SMTP id mp31-20020a1709071b1f00b0072f56dbcce9mr11150184ejc.605.1660594671576; Mon, 15 Aug 2022 13:17:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594671; cv=none; d=google.com; s=arc-20160816; b=vXuhXRUlH5LVRqwYCAoi7e+W0oAhf0wbYEHZ4gKqy6SPF/Z7sDZVCM2ox1bphqteuB qRCRTpZA9vg1viSUXSbxHrxQJbMCJ6m0G51fH54ph1g4AyUE80y5bp9VwKUWptRoisVL BuTp7W+l8zeCtiECDfEayuVstzW97DJoejoGVQNOidJZPMkhOCVO2cGKwg+BtRdzj+tP iclfVvyahlzAFJCOgxPpjNmoKZSuva589fdm/hBQf3pFeWIUJO6dejLRB/sLd+eg78fx xtmz1Pb0HGsNR/YHgLAyKpmFloMyiNbu/u2fu3kUEM9VpzMCjMOppbdZRkxcid/LV2Y3 rgEg== 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=y3sgynXVUwvXvqKLj6jvtcyu2FCK9DD2HVw59IxHdsk=; b=jgLRvLN4WntUVgjABHiops4Y/O4y4Yyw3mYetOIwnltR9lzUdFSoep17GPGKRHEyFC TKYeGAZNuauJWk3RcdQ4p+W+klg8wfItCGVR6sWGiakb1ZvbnD4OBHPfQNVzbrC0M3ls S7ynFIdHvW+ycEIoDDiBv2QNKHVly8EI8WDYv2Qr7vtUPMV2xdVjaDHW3B3q6U+iAk8C jKiBURFZyCISv9CnfQGQFFjE4y1m7SKrE+zf8JrgIbv1AdpnWxYJQENQfj97rBOijMBQ D2YGV41W9wcIhtYN3bIJS2/d0oFDALa/HciMrOBsXSl2dz1oGZJJ9CDiPDTzLCcH59Ee T/OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iGce04l3; 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 l27-20020a50d6db000000b0043de0917993si8112418edj.216.2022.08.15.13.17.23; Mon, 15 Aug 2022 13:17:51 -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=iGce04l3; 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 S245364AbiHOTHM (ORCPT + 99 others); Mon, 15 Aug 2022 15:07:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245669AbiHOTCe (ORCPT ); Mon, 15 Aug 2022 15:02:34 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2359A4D4CA; Mon, 15 Aug 2022 11:33:41 -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 sin.source.kernel.org (Postfix) with ESMTPS id 0BFA0CE1253; Mon, 15 Aug 2022 18:33:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF894C433C1; Mon, 15 Aug 2022 18:33:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588417; bh=Qd0WN9AbOZnHo0ee9xcyfLl0nqUxk4PoBCVtLLWpov0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iGce04l3QZmxz5b6RV7ff/EpMM87/yL6hrfZXKUJVTetpZMJiJ18IjK40vWzPJula x9PiiNrxbGxkgqolIR37cI3bBQhPL4tT8UwVay7qhz02wkUKAjeGfrHZZNVsaSbFsU 22fbRWyouZHcPSkcfm359w1srOE1VroibAR7MMgE= 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.15 356/779] can: kvaser_usb_hydra: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 20:00:00 +0200 Message-Id: <20220815180352.447930198@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 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 fce3f069cdbc..93d7ee6d17b6 100644 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c @@ -916,8 +916,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++; @@ -1071,8 +1073,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->len; -- 2.35.1