diff mbox series

[net-next] net/sched: remove return value of unregister_tcf_proto_ops

Message ID 20220704124322.355211-1-shaozhengchao@huawei.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net/sched: remove return value of unregister_tcf_proto_ops | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 70 this patch: 70
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 9 this patch: 9
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 79 this patch: 79
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 32 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

shaozhengchao July 4, 2022, 12:43 p.m. UTC
Return value of unregister_tcf_proto_ops is useless, remove it.

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
---
 include/net/pkt_cls.h | 2 +-
 net/sched/cls_api.c   | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)

Comments

Jakub Kicinski July 6, 2022, 1:43 a.m. UTC | #1
On Mon, 4 Jul 2022 20:43:22 +0800 Zhengchao Shao wrote:
> Return value of unregister_tcf_proto_ops is useless, remove it.

s/useless/unused/ ?

Should we add a WARN if the ops getting removed can't be found or there
are callers which depend on handling unregistered ops without a warning?
shaozhengchao July 6, 2022, 1:52 a.m. UTC | #2
-----邮件原件-----
发件人: Jakub Kicinski [mailto:kuba@kernel.org] 
发送时间: 2022年7月6日 9:43
收件人: shaozhengchao <shaozhengchao@huawei.com>
抄送: linux-kernel@vger.kernel.org; netdev@vger.kernel.org; jhs@mojatatu.com; xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net; edumazet@google.com; pabeni@redhat.com; weiyongjun (A) <weiyongjun1@huawei.com>; yuehaibing <yuehaibing@huawei.com>
主题: Re: [PATCH net-next] net/sched: remove return value of unregister_tcf_proto_ops

On Mon, 4 Jul 2022 20:43:22 +0800 Zhengchao Shao wrote:
> Return value of unregister_tcf_proto_ops is useless, remove it.

s/useless/unused/ ?

Should we add a WARN if the ops getting removed can't be found or there are callers which depend on handling unregistered ops without a warning?

Hi Jakub Kicinski:
	Thank you for your apply. This patch does just remove the return value and change the function type from int to void. It doesn't remove the function.

Zhengchao Shao
Jakub Kicinski July 6, 2022, 7:58 p.m. UTC | #3
On Wed, 6 Jul 2022 01:52:38 +0000 shaozhengchao wrote:
> 	Thank you for your apply. This patch does just remove the
> return value and change the function type from int to void. It
> doesn't remove the function.

I understand. I'm asking you to replace the word "useless" with
"unused". Additionally I'm asking to consider if instead of returning
an error code the function should print a warning if error has occured.
diff mbox series

Patch

diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index 8cf001aed858..d9d90e6925e1 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -23,7 +23,7 @@  struct tcf_walker {
 };
 
 int register_tcf_proto_ops(struct tcf_proto_ops *ops);
-int unregister_tcf_proto_ops(struct tcf_proto_ops *ops);
+void unregister_tcf_proto_ops(struct tcf_proto_ops *ops);
 
 struct tcf_block_ext_info {
 	enum flow_block_binder_type binder_type;
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 9bb4d3dcc994..fdc9acbd56df 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -194,10 +194,9 @@  EXPORT_SYMBOL(register_tcf_proto_ops);
 
 static struct workqueue_struct *tc_filter_wq;
 
-int unregister_tcf_proto_ops(struct tcf_proto_ops *ops)
+void unregister_tcf_proto_ops(struct tcf_proto_ops *ops)
 {
 	struct tcf_proto_ops *t;
-	int rc = -ENOENT;
 
 	/* Wait for outstanding call_rcu()s, if any, from a
 	 * tcf_proto_ops's destroy() handler.
@@ -209,12 +208,11 @@  int unregister_tcf_proto_ops(struct tcf_proto_ops *ops)
 	list_for_each_entry(t, &tcf_proto_base, head) {
 		if (t == ops) {
 			list_del(&t->head);
-			rc = 0;
 			break;
 		}
 	}
 	write_unlock(&cls_mod_lock);
-	return rc;
+	return;
 }
 EXPORT_SYMBOL(unregister_tcf_proto_ops);