Commit c48c94b0 authored by Yang Li's avatar Yang Li Committed by David S. Miller

net/sched: use min() macro instead of doing it manually

Fix following coccicheck warnings:
./net/sched/cls_api.c:3333:17-18: WARNING opportunity for min()
./net/sched/cls_api.c:3389:17-18: WARNING opportunity for min()
./net/sched/cls_api.c:3427:17-18: WARNING opportunity for min()
Reported-by: default avatarAbaci Robot <abaci@linux.alibaba.com>
Signed-off-by: default avatarYang Li <yang.lee@linux.alibaba.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f7a5319b
...@@ -3330,7 +3330,7 @@ int tc_setup_cb_add(struct tcf_block *block, struct tcf_proto *tp, ...@@ -3330,7 +3330,7 @@ int tc_setup_cb_add(struct tcf_block *block, struct tcf_proto *tp,
up_read(&block->cb_lock); up_read(&block->cb_lock);
if (take_rtnl) if (take_rtnl)
rtnl_unlock(); rtnl_unlock();
return ok_count < 0 ? ok_count : 0; return min(ok_count, 0);
} }
EXPORT_SYMBOL(tc_setup_cb_add); EXPORT_SYMBOL(tc_setup_cb_add);
...@@ -3386,7 +3386,7 @@ int tc_setup_cb_replace(struct tcf_block *block, struct tcf_proto *tp, ...@@ -3386,7 +3386,7 @@ int tc_setup_cb_replace(struct tcf_block *block, struct tcf_proto *tp,
up_read(&block->cb_lock); up_read(&block->cb_lock);
if (take_rtnl) if (take_rtnl)
rtnl_unlock(); rtnl_unlock();
return ok_count < 0 ? ok_count : 0; return min(ok_count, 0);
} }
EXPORT_SYMBOL(tc_setup_cb_replace); EXPORT_SYMBOL(tc_setup_cb_replace);
...@@ -3424,7 +3424,7 @@ int tc_setup_cb_destroy(struct tcf_block *block, struct tcf_proto *tp, ...@@ -3424,7 +3424,7 @@ int tc_setup_cb_destroy(struct tcf_block *block, struct tcf_proto *tp,
up_read(&block->cb_lock); up_read(&block->cb_lock);
if (take_rtnl) if (take_rtnl)
rtnl_unlock(); rtnl_unlock();
return ok_count < 0 ? ok_count : 0; return min(ok_count, 0);
} }
EXPORT_SYMBOL(tc_setup_cb_destroy); EXPORT_SYMBOL(tc_setup_cb_destroy);
......
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