Adding Netlink support to the slcan driver made it necessary to set the bitrate to a fake value (-1U) to prevent open_candev() from failing. In this case the command `ip --details -s -s link show' would print 4294967295 as the bitrate value. The patch change this value in 0. Suggested-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> Signed-off-by: Dario Binacchi <dario.binacchi@xxxxxxxxxxxxxxxxxxxx> --- (no changes since v1) drivers/net/can/dev/netlink.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/can/dev/netlink.c b/drivers/net/can/dev/netlink.c index 7633d98e3912..788a6752fcc7 100644 --- a/drivers/net/can/dev/netlink.c +++ b/drivers/net/can/dev/netlink.c @@ -505,11 +505,16 @@ static int can_fill_info(struct sk_buff *skb, const struct net_device *dev) struct can_ctrlmode cm = {.flags = priv->ctrlmode}; struct can_berr_counter bec = { }; enum can_state state = priv->state; + __u32 bitrate = priv->bittiming.bitrate; + int ret = 0; if (priv->do_get_state) priv->do_get_state(dev, &state); - if ((priv->bittiming.bitrate && + if (bitrate == -1U) + priv->bittiming.bitrate = 0; + + if ((bitrate && nla_put(skb, IFLA_CAN_BITTIMING, sizeof(priv->bittiming), &priv->bittiming)) || @@ -563,9 +568,10 @@ static int can_fill_info(struct sk_buff *skb, const struct net_device *dev) can_ctrlmode_ext_fill_info(skb, priv) ) - return -EMSGSIZE; + ret = -EMSGSIZE; - return 0; + priv->bittiming.bitrate = bitrate; + return ret; } static size_t can_get_xstats_size(const struct net_device *dev) -- 2.32.0