Skip to content

Commit 2f4f0f3

Browse files
anssihmarckleinebudde
authored andcommitted
can: xilinx_can: fix incorrect clear of non-processed interrupts
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: b1201e4 ("can: xilinx CAN controller support") Signed-off-by: Anssi Hannula <[email protected]> Cc: Michal Simek <[email protected]> Cc: <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 8399799 commit 2f4f0f3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/net/can/xilinx_can.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,7 @@ static irqreturn_t xcan_interrupt(int irq, void *dev_id)
938938
struct net_device *ndev = (struct net_device *)dev_id;
939939
struct xcan_priv *priv = netdev_priv(ndev);
940940
u32 isr, ier;
941+
u32 isr_errors;
941942

942943
/* Get the interrupt status from Xilinx CAN */
943944
isr = priv->read_reg(priv, XCAN_ISR_OFFSET);
@@ -956,11 +957,10 @@ static irqreturn_t xcan_interrupt(int irq, void *dev_id)
956957
xcan_tx_interrupt(ndev, isr);
957958

958959
/* Check for the type of error interrupt and Processing it */
959-
if (isr & (XCAN_IXR_ERROR_MASK | XCAN_IXR_RXOFLW_MASK |
960-
XCAN_IXR_BSOFF_MASK | XCAN_IXR_ARBLST_MASK)) {
961-
priv->write_reg(priv, XCAN_ICR_OFFSET, (XCAN_IXR_ERROR_MASK |
962-
XCAN_IXR_RXOFLW_MASK | XCAN_IXR_BSOFF_MASK |
963-
XCAN_IXR_ARBLST_MASK));
960+
isr_errors = isr & (XCAN_IXR_ERROR_MASK | XCAN_IXR_RXOFLW_MASK |
961+
XCAN_IXR_BSOFF_MASK | XCAN_IXR_ARBLST_MASK);
962+
if (isr_errors) {
963+
priv->write_reg(priv, XCAN_ICR_OFFSET, isr_errors);
964964
xcan_err_interrupt(ndev, isr);
965965
}
966966

0 commit comments

Comments
 (0)