Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1648493pxy; Mon, 2 Aug 2021 07:03:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNtHZ/08f0vGrJljzCyXp8gr4Ka1LNvyclfquMUsIkUpBItJFYeUC1R6SHfkD4qMmfXHhY X-Received: by 2002:a17:906:8606:: with SMTP id o6mr15650467ejx.247.1627913021643; Mon, 02 Aug 2021 07:03:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627913021; cv=none; d=google.com; s=arc-20160816; b=GpKj2dWFnS/RnJ7SYJfWmsTAZf34aqLGQLhyah0ZDOTywtYW690tZanKV98cF1rAg/ 4myiozs7X3IbgBMhs54sx5xD2Pz0sh+52vem9/2obEZ4NBGxRWMUGn2eiUADsqvqCbL/ bmF6HpXcTBG/LYeS+FjnMRO+9YvCM8i7ThftrfwXmf4ZwiyoCK3ER+gE4lrWJmXT4peE fmNM+mUY/KUmTQObIdNAiN+G0bsZ+KSLvl2IXrf7l4lpNtdj+TD3oxEX+wlcgn1G9Hdh jcNOUnUuSPKBPVG48ke6ML77n05XjdgiJM18VO6HtWvMb7raODNZaMrrhiQSsS81JunV wjWQ== 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=sb8pyYN4ZOtstI5lzm7aQD2Z99xgWzabRNDbq5bHYyI=; b=j29LEcxzASwwbERQ2biiEMRNnekC3odSgaiL4J72XwY+q5EvFPr3l4qgFWMiRvOdSX Ga9C0JdH7QTl3Q51d3zQr5aNTQKcslcJWgFLJJRCkwAcB9IMnBKE2as0CF2fxvrSwGf1 wJa56vJES1qt49OTuyL2nAXx1pIrozpEyYYYsPqvWPihfU3kKEZ4vehjO0vJBJMRyW8j zATQKWz4sjVmTzegCnBl/4n7KGyGnBD58utOUua/yiB2gzVWjE5/HLIVruPPDpm+ISpN 1G2M/Q5mexuzoxZg5oRDZ3SM4eW/CHFTpRa3y36I8eKcA5sGJu/G4Jp1ujfvukQKpHTa 8cuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=do+vMeC9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h25si11186310edq.396.2021.08.02.07.03.19; Mon, 02 Aug 2021 07:03:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=do+vMeC9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S236243AbhHBOCA (ORCPT + 99 others); Mon, 2 Aug 2021 10:02:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:34014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235471AbhHBNx2 (ORCPT ); Mon, 2 Aug 2021 09:53:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6F27061167; Mon, 2 Aug 2021 13:52:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627912336; bh=bxJ8tGCXaqtCch2tzQcZ2uv/t86rYWidShSEfUuHCcM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=do+vMeC9nfl28P21oC6liU5v0X3br9FzWRvz7ThQJS5+CCtuImm6B4Rn8OwrfsNhA 8pNWR+UlDc4yWHqXMTYgCqTzGe1U9pwAApzSuv2mQdiU7MtjbN+z33AuP5M2C/jTB0 Kaap90lVqnpEr25vTFlZcSdiM6tdYL77MRc2z7XQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephane Grosjean , Marc Kleine-Budde Subject: [PATCH 5.10 14/67] can: peak_usb: pcan_usb_handle_bus_evt(): fix reading rxerr/txerr values Date: Mon, 2 Aug 2021 15:44:37 +0200 Message-Id: <20210802134339.501924102@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210802134339.023067817@linuxfoundation.org> References: <20210802134339.023067817@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stephane Grosjean commit 590eb2b7d8cfafb27e8108d52d4bf4850626d31d upstream. This patch fixes an incorrect way of reading error counters in messages received for this purpose from the PCAN-USB interface. These messages inform about the increase or decrease of the error counters, whose values are placed in bytes 1 and 2 of the message data (not 0 and 1). Fixes: ea8b33bde76c ("can: pcan_usb: add support of rxerr/txerr counters") Link: https://lore.kernel.org/r/20210625130931.27438-4-s.grosjean@peak-system.com Cc: linux-stable Signed-off-by: Stephane Grosjean Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/usb/peak_usb/pcan_usb.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/drivers/net/can/usb/peak_usb/pcan_usb.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb.c @@ -117,7 +117,8 @@ MODULE_SUPPORTED_DEVICE("PEAK-System PCA #define PCAN_USB_BERR_MASK (PCAN_USB_ERR_RXERR | PCAN_USB_ERR_TXERR) /* identify bus event packets with rx/tx error counters */ -#define PCAN_USB_ERR_CNT 0x80 +#define PCAN_USB_ERR_CNT_DEC 0x00 /* counters are decreasing */ +#define PCAN_USB_ERR_CNT_INC 0x80 /* counters are increasing */ /* private to PCAN-USB adapter */ struct pcan_usb { @@ -611,11 +612,12 @@ static int pcan_usb_handle_bus_evt(struc /* acccording to the content of the packet */ switch (ir) { - case PCAN_USB_ERR_CNT: + case PCAN_USB_ERR_CNT_DEC: + case PCAN_USB_ERR_CNT_INC: /* save rx/tx error counters from in the device context */ - pdev->bec.rxerr = mc->ptr[0]; - pdev->bec.txerr = mc->ptr[1]; + pdev->bec.rxerr = mc->ptr[1]; + pdev->bec.txerr = mc->ptr[2]; break; default: