]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
net/sched: act_api: don't open code max()
authorPedro Tammela <pctammela@mojatatu.com>
Fri, 8 Dec 2023 19:28:44 +0000 (16:28 -0300)
committerJakub Kicinski <kuba@kernel.org>
Tue, 12 Dec 2023 02:52:57 +0000 (18:52 -0800)
Use max() in a couple of places that are open coding it with the
ternary operator.

Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20231208192847.714940-5-pctammela@mojatatu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/sched/act_api.c

index abec5c45b5a49a0c8b3d02adf7385226aca46877..4f295ae4e152e2bb508cfa2fd6306f52739612c5 100644 (file)
@@ -1796,8 +1796,7 @@ tcf_reoffload_del_notify(struct net *net, struct tc_action *action)
        struct sk_buff *skb;
        int ret;
 
-       skb = alloc_skb(attr_size <= NLMSG_GOODSIZE ? NLMSG_GOODSIZE : attr_size,
-                       GFP_KERNEL);
+       skb = alloc_skb(max(attr_size, NLMSG_GOODSIZE), GFP_KERNEL);
        if (!skb)
                return -ENOBUFS;
 
@@ -1882,8 +1881,7 @@ tcf_del_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[],
        int ret;
        struct sk_buff *skb;
 
-       skb = alloc_skb(attr_size <= NLMSG_GOODSIZE ? NLMSG_GOODSIZE : attr_size,
-                       GFP_KERNEL);
+       skb = alloc_skb(max(attr_size, NLMSG_GOODSIZE), GFP_KERNEL);
        if (!skb)
                return -ENOBUFS;
 
@@ -1961,8 +1959,7 @@ tcf_add_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[],
 {
        struct sk_buff *skb;
 
-       skb = alloc_skb(attr_size <= NLMSG_GOODSIZE ? NLMSG_GOODSIZE : attr_size,
-                       GFP_KERNEL);
+       skb = alloc_skb(max(attr_size, NLMSG_GOODSIZE), GFP_KERNEL);
        if (!skb)
                return -ENOBUFS;