diff options
author | Lin Ma <linma@zju.edu.cn> | 2023-06-15 17:22:40 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-06-17 09:25:24 +0200 |
commit | f60ce8a48b97eb970bfbec1f26c914b9017c4a46 (patch) | |
tree | 02c1afbe6a61c19896968194c68ee34e4dbefecd /net/mctp/route.c | |
parent | netlink: specs: fixup openvswitch specs for code generation (diff) | |
download | linux-f60ce8a48b97eb970bfbec1f26c914b9017c4a46.tar.xz linux-f60ce8a48b97eb970bfbec1f26c914b9017c4a46.zip |
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: Lin Ma <linma@zju.edu.cn>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Acked-by: Jeremy Kerr <jk@codeconstruct.com.au>
Link: https://lore.kernel.org/r/20230615152240.1749428-1-linma@zju.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/mctp/route.c')
-rw-r--r-- | net/mctp/route.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/net/mctp/route.c b/net/mctp/route.c index f51a05ec7162..ab62fe447038 100644 --- a/net/mctp/route.c +++ b/net/mctp/route.c @@ -1249,9 +1249,6 @@ static int mctp_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, 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, rtm->rtm_type); return rc; |