Fix the following sparse warning:
lib/test_lockup.c:145:14: warning: symbol 'test_inode' was not declared.
Should it be static?
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Jason Yan <[email protected]>
---
lib/test_lockup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/test_lockup.c b/lib/test_lockup.c
index ea09ca335b21..419fbaceba73 100644
--- a/lib/test_lockup.c
+++ b/lib/test_lockup.c
@@ -142,7 +142,7 @@ module_param(reallocate_pages, bool, 0400);
MODULE_PARM_DESC(reallocate_pages, "free and allocate pages between iterations");
struct file *test_file;
-struct inode *test_inode;
+static struct inode *test_inode;
static char test_file_path[256];
module_param_string(file_path, test_file_path, sizeof(test_file_path), 0400);
MODULE_PARM_DESC(file_path, "file path to test");
--
2.21.1
On 17/04/2020 10.40, Jason Yan wrote:
> Fix the following sparse warning:
>
> lib/test_lockup.c:145:14: warning: symbol 'test_inode' was not declared.
> Should it be static?
Yep, but that's not so important.
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Jason Yan <[email protected]>
> ---
> lib/test_lockup.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/test_lockup.c b/lib/test_lockup.c
> index ea09ca335b21..419fbaceba73 100644
> --- a/lib/test_lockup.c
> +++ b/lib/test_lockup.c
> @@ -142,7 +142,7 @@ module_param(reallocate_pages, bool, 0400);
> MODULE_PARM_DESC(reallocate_pages, "free and allocate pages between iterations");
>
> struct file *test_file;
Why you're fixing only this warning? =)
test_file above should generate the same.
> -struct inode *test_inode;
> +static struct inode *test_inode;
> static char test_file_path[256];
> module_param_string(file_path, test_file_path, sizeof(test_file_path), 0400);
> MODULE_PARM_DESC(file_path, "file path to test");
>