]> www.infradead.org Git - users/hch/misc.git/commitdiff
can: netlink: remove useless check in can_tdc_changelink()
authorVincent Mailhol <mailhol@kernel.org>
Tue, 23 Sep 2025 06:58:33 +0000 (15:58 +0900)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 24 Sep 2025 15:09:45 +0000 (17:09 +0200)
can_tdc_changelink() return -EOPNOTSUPP under this condition:

  !tdc_const || !can_fd_tdc_is_enabled(priv)

But this function is only called if the data[IFLA_CAN_TDC] parameters
are provided. At this point, can_validate_tdc() already checked that
either of the tdc auto or tdc manual control modes were provided, that
is to say, can_fd_tdc_is_enabled(priv) must be true.

Because the right hand operand of this condition is always true,
remove it.

Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
Link: https://patch.msgid.link/20250923-canxl-netlink-prep-v4-8-e720d28f66fe@kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/dev/netlink.c

index c212c7ff26cd3367d2014db99de7534077a1a841..17ed52d238e3a17e946116a94c7c5f503e184c3d 100644 (file)
@@ -180,7 +180,7 @@ static int can_tdc_changelink(struct can_priv *priv, const struct nlattr *nla,
        const struct can_tdc_const *tdc_const = priv->fd.tdc_const;
        int err;
 
-       if (!tdc_const || !can_fd_tdc_is_enabled(priv))
+       if (!tdc_const)
                return -EOPNOTSUPP;
 
        err = nla_parse_nested(tb_tdc, IFLA_CAN_TDC_MAX, nla,