Skip to contentSkip to conversation

staging: lustre: linux-prim.c: fix sparse warnings about static declaration

PATCH Superseded Serguey Parkhomovsky 3 participants 4 messages Dec 30, 2014 – Dec 31, 2014 Staging

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: lustre: linux-prim.c: fix sparse warnings about static declaration

Fixes the following sparse warnings:

drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c:198:1: warning: symbol 'libcfs_arch_init' was not declared. Should it be static? drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c:204:1: warning: symbol 'libcfs_arch_cleanup' was not declared. Should it be static?

---
 drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c +2 -4
index 19f405e..4fee73f 100644
@@ -194,14 +194,12 @@ cfs_clear_sigpending(void)
 	spin_unlock_irqrestore(&current->sighand->siglock, flags);
 }
 
-int
-libcfs_arch_init(void)
+static int libcfs_arch_init(void)
 {
 	return 0;
 }
 
-void
-libcfs_arch_cleanup(void)
+static void libcfs_arch_cleanup(void)
 {
 	return;
 }
Signature · 1 line
1.9.3
#1 lore raw

Serguey,

Quoted 21 lines · Serguey Parkhomovsky

Fixes the following sparse warnings:

drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c:198:1: warning: symbol 'libcfs_arch_init' was not declared. Should it be static? drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c:204:1: warning: symbol 'libcfs_arch_cleanup' was not declared. Should it be static?

---
 drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c +1 -2
index 19f405e..4fee73f 100644
@@ -194,14 +194,12 @@ cfs_clear_sigpending(void)
 	spin_unlock_irqrestore(&current->sighand->siglock, flags);
 }
 
-int
-libcfs_arch_init(void)
+static int libcfs_arch_init(void)

drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c cfs_clear_sigpending(void) · line 205

Quoted 10 lines
drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c +1 -2
 {
 	return 0;
 }
 
-void
-libcfs_arch_cleanup(void)
+static void libcfs_arch_cleanup(void)
 {
 	return;
 }

If you look at the source code just below these functions you will find:

EXPORT_SYMBOL(libcfs_arch_init);
EXPORT_SYMBOL(libcfs_arch_cleanup);

So making these static is incorrect because they are being used outside of this file.

Quoted 8 lines
Signature · 7 lines
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Signature · 1 line
- Jeremiah Mahler
#2 lore raw
Quoted 9 lines · Jeremiah Mahler

If you look at the source code just below these functions you will find:

EXPORT_SYMBOL(libcfs_arch_init);
EXPORT_SYMBOL(libcfs_arch_cleanup);

So making these static is incorrect because they are being used outside of this file.

Thanks for the review, and sorry about the noise; I'll be more careful next time.

Serguey

#3 lore raw
Quoted 4 lines · Serguey Parkhomovsky
Quoted 3 lines · Jeremiah Mahler

If you look at the source code just below these functions you will find:

Quoted 8 lines
Quoted 6 lines

EXPORT_SYMBOL(libcfs_arch_init);
EXPORT_SYMBOL(libcfs_arch_cleanup);

So making these static is incorrect because they are being used outside of this file.

Thanks for the review, and sorry about the noise; I'll be more careful next time.

these tools are there to help you find the problems in the code.but after that we need to use our own judgement to decide. in this case the solution is to declare them in libcfs.h

and please atleast buildtest your patch before sending. If you would have compiled this patch then you could have seen 2 new warnings:
"WARNING: "libcfs_arch_init" [drivers/staging/lustre/lustre/libcfs/libcfs.ko] undefined!"
"WARNING: "libcfs_arch_cleanup" [drivers/staging/lustre/lustre/libcfs/libcfs.ko] undefined!"

thanks
sudip

Quoted 7 lines

Serguey
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/