Commit f60ce8a4 authored by Lin Ma's avatar Lin Ma Committed by Jakub Kicinski

net: mctp: remove redundant RTN_UNICAST check

Current mctp_newroute() contains two exactly same check against
rtm->rtm_type

static int mctp_newroute(...)
{
...
    if (rtm->rtm_type != RTN_UNICAST) { // (1)
        NL_SET_ERR_MSG(extack, "rtm_type must be RTN_UNICAST");
        return -EINVAL;
    }
...
    if (rtm->rtm_type != RTN_UNICAST) // (2)
        return -EINVAL;
...
}

This commits removes the (2) check as it is redundant.
Signed-off-by: default avatarLin Ma <linma@zju.edu.cn>
Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
Acked-by: default avatarJeremy Kerr <jk@codeconstruct.com.au>
Link: https://lore.kernel.org/r/20230615152240.1749428-1-linma@zju.edu.cnSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 6907217a
...@@ -1249,9 +1249,6 @@ static int mctp_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -1249,9 +1249,6 @@ static int mctp_newroute(struct sk_buff *skb, struct nlmsghdr *nlh,
mtu = nla_get_u32(tbx[RTAX_MTU]); mtu = nla_get_u32(tbx[RTAX_MTU]);
} }
if (rtm->rtm_type != RTN_UNICAST)
return -EINVAL;
rc = mctp_route_add(mdev, daddr_start, rtm->rtm_dst_len, mtu, rc = mctp_route_add(mdev, daddr_start, rtm->rtm_dst_len, mtu,
rtm->rtm_type); rtm->rtm_type);
return rc; return rc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment