fix warning of not used variable
PATCH 2/3 fix warning of not used variable
fix this warning:kernel/module.c:824: warning: ‘print_unload_info’ defined but not used print_unload_info() just used when CONFIG_PROC_FS was defined.
--- kernel/module.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
kernel/module.c +5 -0
@@ -820,6 +820,7 @@ sys_delete_module(const char __user *name_user, unsigned int flags)return ret; } +#ifdef CONFIG_PROC_FS static void print_unload_info (struct seq_file *m,struct module *mod) {struct module_use *use;
@@ -842,6 +843,7 @@ static void print_unload_info(struct seq_file *m, struct module *mod)if (!printed_something) seq_printf(m, "-"); } +#endif void __symbol_put (const char *symbol) {
@@ -893,11 +895,14 @@ void module_put(struct module *module)EXPORT_SYMBOL (module_put);#else /* !CONFIG_MODULE_UNLOAD */ + +#ifdef CONFIG_PROC_FS static void print_unload_info (struct seq_file *m,struct module *mod) {/* We don't know the usage count, or what modules are using. */ seq_printf (m," - -" ); } +#endif static inline void module_unload_free (struct module *mod) {
Signature · 6 lines
1.5.6.3 -- Jianjun Kong | Happy Hacking HOMEPAGE: http://kongove.cn/ GTALK: [email protected]
Quoted 9 lines · Jianjun Kong
fix this warning:
kernel/module.c:824: warning: ‘print_unload_info’ defined but not usedprint_unload_info()just used whenCONFIG_PROC_FSwas defined.Signed-off-by Jianjun Kong <[email protected]>--- kernel/module.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
NAK. Warnings do not need to be "fixed", then need to be looked at and then there are two approaches:
1) GCC is wrong => annotate the code
2) GCC is right => fix the code
Your patch does not give us any idea about which case this is, whether you have analyzed the reason why GCC emitted that warning.
Besides, i dont see such warnings in kernel/module.c with latest GCC.
Ingo
Quoted 8 lines · Ingo Molnar
NAK. Warnings do not need to be "fixed", then need to be looked at and then there are two approaches:
1) GCC is wrong => annotate the code
2) GCC is right => fix the code
Gcc is correct.
The only user of print_unload_info() is m_show() which is protected by CONFIG_PROC_FS.
Quoted 6 lines · Jianjun Kong
fix this warning:
kernel/module.c:824: warning: 'print_unload_info' defined but not usedprint_unload_info()just used whenCONFIG_PROC_FSwas defined.Signed-off-by Jianjun Kong <[email protected]>
Rusty?
Quoted 8 lines · On Thursday 04 December 2008 22:06:33 Américo Wang wrote:
Quoted 5 lines · Jianjun Kong
fix this warning:
kernel/module.c:824: warning: 'print_unload_info' defined but not usedprint_unload_info()just used whenCONFIG_PROC_FSwas defined.Signed-off-by Jianjun Kong <[email protected]>Reviewed-by WANG Cong <[email protected]>
My main concern is that this adds two new #ifdef sections. How about marking both cases "inline" instead?
Cheers,
Rusty.
On Fri, Dec 5, 2008 at 12:01 AM, Rusty Russell <[email protected]> wrote:> On Thursday 04 December 2008 22:06:33 Américo Wang wrote:>> On Thu, Dec 4, 2008 at 1:00 AM, Jianjun Kong <[email protected]> wrote:>> > fix this warning:>> > kernel/module.c:824: warning: 'print_unload_info' defined but not used>> > print_unload_info() just used when CONFIG_PROC_FS was defined.>> >>> > Signed-off-by: Jianjun Kong <[email protected]>>>>> Reviewed-by: WANG Cong <[email protected]>>> My main concern is that this adds two new #ifdef sections. How about marking> both cases "inline" instead?> Hi, sorry for the delay.
Er, making them inline can solve this problem?���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Quoted 11 lines · Américo Wang
Quoted 10 lines · Rusty Russell
Quoted 8 lines · On Thursday 04 December 2008 22:06:33 Américo Wang wrote:
Quoted 5 lines · Jianjun Kong
fix this warning:
kernel/module.c:824: warning: 'print_unload_info' defined but not usedprint_unload_info()just used whenCONFIG_PROC_FSwas defined.Signed-off-by Jianjun Kong <[email protected]>Reviewed-by WANG Cong <[email protected]>
Quoted 7 lines
Quoted 3 lines
My main concern is that this adds two new #ifdef sections. How about marking both cases "inline" instead?
Hi, sorry for the delay.
Er, making them inline can solve this problem?
I have make a new patch, and it can compile without any warning :)
---
From: Jianjun Kong <[email protected]>
Date: Sat, 6 Dec 2008 10:19:09 +0800
Subject: [PATCH] kernel/module.c: fix compile warning
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Fix this warning:kernel/module.c:824: warning: ‘print_unload_info’ defined but not used print_unload_info() just was used when CONFIG_PROC_FS was defined. This patch mark print_unload_info() inline to solve the problem.
--- kernel/module.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/module.c +2 -2
@@ -820,7 +820,7 @@ sys_delete_module(const char __user *name_user, unsigned int flags)return ret; } -static void print_unload_info (struct seq_file *m,struct module *mod) +static inline void print_unload_info (struct seq_file *m,struct module *mod) {struct module_use *use;int printed_something =0 ;
@@ -893,7 +893,7 @@ void module_put(struct module *module)EXPORT_SYMBOL (module_put);#else /* !CONFIG_MODULE_UNLOAD */ -static void print_unload_info (struct seq_file *m,struct module *mod) +static inline void print_unload_info (struct seq_file *m,struct module *mod) {/* We don't know the usage count, or what modules are using. */ seq_printf (m," - -" );
Signature · 7 lines
1.5.6.3 -- Jianjun Kong | Happy Hacking HOMEPAGE: http://kongove.cn/ GTALK: [email protected]