drivers/can: fix netdev_lower_carrier_XXX crash for kvaser card

netdev_lower_carrier_XXX can't be called before netdev is registered

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
p-szafonimateusz 2026-03-17 11:47:15 +01:00 • committed by Alan C. Assis
parent a87bb18531
commit 14b62c50f3

View file

@ -1665,12 +1665,6 @@ static int kvaser_probe(FAR struct pci_device_s *dev)
netdev->quota[NETPKT_RX] = KVASER_RX_QUOTA;
netdev->ops = &g_kvaser_net_ops;
/* Put the interface in the down state. This usually amounts to
* resetting the device and/or calling kvaser_sock_ifdown().
*/
kvaser_sock_ifdown(&priv->sja[i].dev);
/* Register the network interface. */
ret = netdev_lower_register(netdev, NET_LL_CAN);
@ -1679,6 +1673,12 @@ static int kvaser_probe(FAR struct pci_device_s *dev)
pcierr("ERROR: failed to register count=%d, %d\n", i, ret);
goto errout;
}
/* Put the interface in the down state. This usually amounts to
* resetting the device and/or calling kvaser_sock_ifdown().
*/
kvaser_sock_ifdown(&priv->sja[i].dev);
#endif
}