Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3326532imu; Sun, 11 Nov 2018 12:26:34 -0800 (PST) X-Google-Smtp-Source: AJdET5ezwDf3u/bVG+3fwg0E7V2s3I+2aHGT1EltHnJvGE7ojkWLpWryu0zbOw3oVESAsfD5iZdo X-Received: by 2002:a17:902:aa4b:: with SMTP id c11-v6mr16324730plr.303.1541967994125; Sun, 11 Nov 2018 12:26:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541967994; cv=none; d=google.com; s=arc-20160816; b=pqdXPSoVe0PZO1E5VTgkW4UMnzjc7lo/qvu+piv5/QKr1K+DjhRezGIGbFZoUMylgJ bDnr/SyeLMyAcVIqw+8zt41HWyUay8cnUl3X76LL8RVug5Ksg9VZ8DCi5plSY6n+MtJk kB+FuEWHQQy8HB9dOU8ybNUxHTRpR5T60pWx4WUc1lDv+5Ikmoa8/MaZcC9j0ekPdWcO TvwCZy27SihsJReAE9P/U434RM3su/IEvzqvOrUZUxgsJyw71jpSYlm2aMuVVvAqTGzF wUOElVeMHvizCB9ZkfeaBBDdN9eLtqvyhE1Qf3x3EF1haKB7d9XA3epJdRVrvTmgSCql KANQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=aTfBKbqyg7YT7r114gKryYV1uY2VE6zX5mgvEMSHgHI=; b=HzbauRxOs75pfleNenMLSDuMhpo5NrO+2s+lTCCdEbuIwluKbL3FPAPlLB/aE/qI8f TUbJj62zCiU+t7fQOerA51XBL7Bduc8NRtjwsWHYDjzh4PXS1BSVZh+xN2DVjn6voMnJ q6fvdtQUlJj+SE9jw9DAHnAdUU642Us0qOPUuorhPJBNzvtjkLUPERkNQN6Fx8H5ovRy /tW9a6Y146v18fPNAklcvDWEAl/ApngUjn/JtxQfB0oo2m9ia6XopmEiaP2IZE4RB/hz HHCx/FDmo7tVEFg/MwJBFa+Fsk5BQJyVTcsQr0KLlon3u9mKZ0TDU+0AopiQWzgYuPgm +1Ng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u28si14481612pgn.436.2018.11.11.12.26.18; Sun, 11 Nov 2018 12:26:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730820AbeKLGPR (ORCPT + 99 others); Mon, 12 Nov 2018 01:15:17 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:50920 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730649AbeKLFs2 (ORCPT ); Mon, 12 Nov 2018 00:48:28 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvsn-0000oG-6M; Sun, 11 Nov 2018 19:58:57 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsY-0001lw-0e; Sun, 11 Nov 2018 19:58:42 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Marc Kleine-Budde" , "Michal Simek" , "Anssi Hannula" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 286/366] can: xilinx_can: fix incorrect clear of non-processed interrupts In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Anssi Hannula commit 2f4f0f338cf453bfcdbcf089e177c16f35f023c8 upstream. xcan_interrupt() clears ERROR|RXOFLV|BSOFF|ARBLST interrupts if any of them is asserted. This does not take into account that some of them could have been asserted between interrupt status read and interrupt clear, therefore clearing them without handling them. Fix the code to only clear those interrupts that it knows are asserted and therefore going to be processed in xcan_err_interrupt(). Fixes: b1201e44f50b ("can: xilinx CAN controller support") Signed-off-by: Anssi Hannula Cc: Michal Simek Signed-off-by: Marc Kleine-Budde Signed-off-by: Ben Hutchings --- drivers/net/can/xilinx_can.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c @@ -939,6 +939,7 @@ static irqreturn_t xcan_interrupt(int ir struct net_device *ndev = (struct net_device *)dev_id; struct xcan_priv *priv = netdev_priv(ndev); u32 isr, ier; + u32 isr_errors; /* Get the interrupt status from Xilinx CAN */ isr = priv->read_reg(priv, XCAN_ISR_OFFSET); @@ -957,11 +958,10 @@ static irqreturn_t xcan_interrupt(int ir xcan_tx_interrupt(ndev, isr); /* Check for the type of error interrupt and Processing it */ - if (isr & (XCAN_IXR_ERROR_MASK | XCAN_IXR_RXOFLW_MASK | - XCAN_IXR_BSOFF_MASK | XCAN_IXR_ARBLST_MASK)) { - priv->write_reg(priv, XCAN_ICR_OFFSET, (XCAN_IXR_ERROR_MASK | - XCAN_IXR_RXOFLW_MASK | XCAN_IXR_BSOFF_MASK | - XCAN_IXR_ARBLST_MASK)); + isr_errors = isr & (XCAN_IXR_ERROR_MASK | XCAN_IXR_RXOFLW_MASK | + XCAN_IXR_BSOFF_MASK | XCAN_IXR_ARBLST_MASK); + if (isr_errors) { + priv->write_reg(priv, XCAN_ICR_OFFSET, isr_errors); xcan_err_interrupt(ndev, isr); }