]> git.baikalelectronics.ru Git - kernel.git/commitdiff
can: peak_usb: pcan_usb_fd_decode_status(): remove unnecessary test on the nullity...
authorStephane Grosjean <s.grosjean@peak-system.com>
Wed, 29 Sep 2021 14:21:11 +0000 (16:21 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Sun, 17 Oct 2021 20:51:51 +0000 (22:51 +0200)
Since alloc_can_err_skb() puts NULL in cf in the case when skb cannot
be allocated and can_change_state() handles the case when cf is NULL,
the test on the nullity of skb is now unnecessary.

Link: https://lore.kernel.org/all/20210929142111.55757-2-s.grosjean@peak-system.com
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 e206959b3d06c5e3bffc52638f9071d25c9905b2..09029a3bad1ac3e8df64ae8bfd04f0475707d8fd 100644 (file)
@@ -567,8 +567,7 @@ static int pcan_usb_fd_decode_status(struct pcan_usb_fd_if *usb_if,
 
        /* allocate an skb to store the error frame */
        skb = alloc_can_err_skb(netdev, &cf);
-       if (skb)
-               can_change_state(netdev, cf, tx_state, rx_state);
+       can_change_state(netdev, cf, tx_state, rx_state);
 
        /* things must be done even in case of OOM */
        if (new_state == CAN_STATE_BUS_OFF)