OSDN Git Service

can: peak_usb: pcan_usb_fd_decode_status(): fix back to ERROR_ACTIVE state notification
authorStephane Grosjean <s.grosjean@peak-system.com>
Wed, 29 Sep 2021 14:21:10 +0000 (16:21 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Sun, 17 Oct 2021 20:51:51 +0000 (22:51 +0200)
This corrects the lack of notification of a return to ERROR_ACTIVE
state for USB - CANFD devices from PEAK-System.

Fixes: 0a25e1f4f185 ("can: peak_usb: add support for PEAK new CANFD USB adapters")
Link: https://lore.kernel.org/all/20210929142111.55757-1-s.grosjean@peak-system.com
Cc: stable@vger.kernel.org
Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/usb/peak_usb/pcan_usb_fd.c

index b11eaba..e206959 100644 (file)
@@ -551,11 +551,10 @@ static int pcan_usb_fd_decode_status(struct pcan_usb_fd_if *usb_if,
        } else if (sm->channel_p_w_b & PUCAN_BUS_WARNING) {
                new_state = CAN_STATE_ERROR_WARNING;
        } else {
-               /* no error bit (so, no error skb, back to active state) */
-               dev->can.state = CAN_STATE_ERROR_ACTIVE;
+               /* back to (or still in) ERROR_ACTIVE state */
+               new_state = CAN_STATE_ERROR_ACTIVE;
                pdev->bec.txerr = 0;
                pdev->bec.rxerr = 0;
-               return 0;
        }
 
        /* state hasn't changed */