From patchwork Tue Nov 18 11:00:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dong Aisheng X-Patchwork-Id: 411999 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 287FD140174 for ; Tue, 18 Nov 2014 23:08:04 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753460AbaKRMH7 (ORCPT ); Tue, 18 Nov 2014 07:07:59 -0500 Received: from mail-bn1bon0146.outbound.protection.outlook.com ([157.56.111.146]:34879 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753512AbaKRMH5 (ORCPT ); Tue, 18 Nov 2014 07:07:57 -0500 Received: from CH1PR03CA003.namprd03.prod.outlook.com (10.255.156.148) by CY1PR0301MB1225.namprd03.prod.outlook.com (25.161.212.147) with Microsoft SMTP Server (TLS) id 15.1.16.15; Tue, 18 Nov 2014 12:07:53 +0000 Received: from BN1BFFO11FD017.protection.gbl (10.255.156.132) by CH1PR03CA003.outlook.office365.com (10.255.156.148) with Microsoft SMTP Server (TLS) id 15.1.16.15 via Frontend Transport; Tue, 18 Nov 2014 12:07:53 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD017.mail.protection.outlook.com (10.58.144.80) with Microsoft SMTP Server (TLS) id 15.1.6.13 via Frontend Transport; Tue, 18 Nov 2014 12:07:50 +0000 Received: from shlinux2.ap.freescale.net (shlinux2.ap.freescale.net [10.192.224.44]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id sAIC7j74022540; Tue, 18 Nov 2014 05:07:46 -0700 From: Dong Aisheng To: CC: , , , , , , Subject: [PATCH V5 1/2] can: m_can: fix not set can_dlc for remote frame Date: Tue, 18 Nov 2014 19:00:54 +0800 Message-ID: <1416308455-29134-1-git-send-email-b29396@freescale.com> X-Mailer: git-send-email 1.9.1 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(199003)(189002)(20776003)(47776003)(31966008)(64706001)(104166001)(92566001)(106466001)(77156002)(102836001)(95666004)(2351001)(62966003)(99396003)(21056001)(107046002)(229853001)(89996001)(110136001)(33646002)(104016003)(92726001)(105606002)(88136002)(84676001)(87286001)(120916001)(68736004)(50466002)(46102003)(4396001)(19580405001)(36756003)(93916002)(97736003)(6806004)(50226001)(44976005)(50986999)(19580395003)(87936001)(48376002)(575784001)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0301MB1225; H:tx30smr01.am.freescale.net; FPR:; MLV:sfv; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1225; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:; SRVR:CY1PR0301MB1225; X-Forefront-PRVS: 039975700A Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=Aisheng.Dong@freescale.com; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:; SRVR:CY1PR0301MB1225; X-OriginatorOrg: freescale.com Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The original code missed to set the cf->can_dlc in the RTR case, so add it. Signed-off-by: Dong Aisheng --- drivers/net/can/m_can/m_can.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index 06541f1..2f61676 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -331,7 +331,7 @@ static void m_can_read_fifo(const struct net_device *dev, struct can_frame *cf, u32 rxfs) { struct m_can_priv *priv = netdev_priv(dev); - u32 id, fgi; + u32 id, fgi, dlc; /* calculate the fifo get index for where to read data */ fgi = (rxfs & RXFS_FGI_MASK) >> RXFS_FGI_OFF; @@ -341,11 +341,12 @@ static void m_can_read_fifo(const struct net_device *dev, struct can_frame *cf, else cf->can_id = (id >> 18) & CAN_SFF_MASK; + dlc = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC); + cf->can_dlc = get_can_dlc((dlc >> 16) & 0x0F); + if (id & RX_BUF_RTR) { cf->can_id |= CAN_RTR_FLAG; } else { - id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC); - cf->can_dlc = get_can_dlc((id >> 16) & 0x0F); *(u32 *)(cf->data + 0) = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DATA(0)); *(u32 *)(cf->data + 4) = m_can_fifo_read(priv, fgi,