Skip to contentSkip to conversation

lib/test_vmalloc.c: three trivial fixes

PATCH Applied Martin Kaiser 2 participants 7 messages Feb 26, 2024 – Feb 27, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover lib/test_vmalloc.c: three trivial fixes

Here's three trivial changes to fix a typo, address a checkpatch warning and remove an unused function.

Martin Kaiser (3):
lib/test_vmalloc.c: fix typo in function name
lib/test_vmalloc.c: drop empty exit function
lib/test_vmalloc.c: use unsigned long constant

 lib/test_vmalloc.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/3 lib/test_vmalloc.c: fix typo in function name

Fix a typo and change the function name to init_test_configuration. Both caller and definition have the same typo, so the current code already works.

---
 lib/test_vmalloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/test_vmalloc.c +2 -2
index 3718d9886407..191b6bd5dff9 100644
@@ -501,7 +501,7 @@ static int test_func(void *private)
 }
 
 static int
-init_test_configurtion(void)
+init_test_configuration(void)
 {
 	/*
 	 * A maximum number of workers is defined as hard-coded
@@ -531,7 +531,7 @@ static void do_concurrent_test(void)
 	/*
 	 * Set some basic configurations plus sanity check.
 	 */
-	ret = init_test_configurtion();
+	ret = init_test_configuration();
 	if (ret < 0)
 		return;
 
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] lib/test_vmalloc.c: fix typo in function name

Quoted 34 lines · Martin Kaiser

Fix a typo and change the function name to init_test_configuration. Both caller and definition have the same typo, so the current code already works.

---
 lib/test_vmalloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/test_vmalloc.c +2 -2
index 3718d9886407..191b6bd5dff9 100644
@@ -501,7 +501,7 @@ static int test_func(void *private)
 }
 
 static int
-init_test_configurtion(void)
+init_test_configuration(void)
 {
 	/*
 	 * A maximum number of workers is defined as hard-coded
@@ -531,7 +531,7 @@ static void do_concurrent_test(void)
 	/*
 	 * Set some basic configurations plus sanity check.
 	 */
-	ret = init_test_configurtion();
+	ret = init_test_configuration();
 	if (ret < 0)
 		return;
 
Signature · 1 line
2.39.2

--
Uladzislau Rezki

#3 lore raw

PATCH 2/3 lib/test_vmalloc.c: drop empty exit function

In reply to Martin Kaiser

The module is never loaded successfully. Therefore, it'll never be unloaded and we can remove the exit function.

---
 lib/test_vmalloc.c | 5 -----
 1 file changed, 5 deletions(-)
lib/test_vmalloc.c +0 -5
index 191b6bd5dff9..d0c0cbe1913d 100644
@@ -600,12 +600,7 @@ static int vmalloc_test_init(void)
 	return -EAGAIN; /* Fail will directly unload the module */
 }
 
-static void vmalloc_test_exit(void)
-{
-}
-
 module_init(vmalloc_test_init)
-module_exit(vmalloc_test_exit)
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Uladzislau Rezki");
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 2/3
#4 lore raw

Re: [PATCH 2/3] lib/test_vmalloc.c: drop empty exit function

Quoted 28 lines · Martin Kaiser

The module is never loaded successfully. Therefore, it'll never be unloaded and we can remove the exit function.

---
 lib/test_vmalloc.c | 5 -----
 1 file changed, 5 deletions(-)
lib/test_vmalloc.c +0 -5
index 191b6bd5dff9..d0c0cbe1913d 100644
@@ -600,12 +600,7 @@ static int vmalloc_test_init(void)
 	return -EAGAIN; /* Fail will directly unload the module */
 }
 
-static void vmalloc_test_exit(void)
-{
-}
-
 module_init(vmalloc_test_init)
-module_exit(vmalloc_test_exit)
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Uladzislau Rezki");
Signature · 1 line
2.39.2

--
Uladzislau Rezki

#5 lore raw

PATCH 3/3 lib/test_vmalloc.c: use unsigned long constant

In reply to Martin Kaiser

Use an unsigned long constant instead of an int constant and a cast. This fixes the checkpatch warning

WARNING: Unnecessary typecast of c90 int constant - '(unsigned long) 1' could be '1UL'
+ align = ((unsigned long) 1) << i;

---
 lib/test_vmalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_vmalloc.c +1 -1
index d0c0cbe1913d..4ddf769861ff 100644
@@ -117,7 +117,7 @@ static int align_shift_alloc_test(void)
 	int i;
 
 	for (i = 0; i < BITS_PER_LONG; i++) {
-		align = ((unsigned long) 1) << i;
+		align = 1UL << i;
 
 		ptr = __vmalloc_node(PAGE_SIZE, align, GFP_KERNEL|__GFP_ZERO, 0,
 				__builtin_return_address(0));
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 3/3
#6 lore raw

Re: [PATCH 3/3] lib/test_vmalloc.c: use unsigned long constant

Quoted 27 lines · Martin Kaiser

Use an unsigned long constant instead of an int constant and a cast. This fixes the checkpatch warning

WARNING: Unnecessary typecast of c90 int constant - '(unsigned long) 1' could be '1UL'
+ align = ((unsigned long) 1) << i;

---
 lib/test_vmalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_vmalloc.c +1 -1
index d0c0cbe1913d..4ddf769861ff 100644
@@ -117,7 +117,7 @@ static int align_shift_alloc_test(void)
 	int i;
 
 	for (i = 0; i < BITS_PER_LONG; i++) {
-		align = ((unsigned long) 1) << i;
+		align = 1UL << i;
 
 		ptr = __vmalloc_node(PAGE_SIZE, align, GFP_KERNEL|__GFP_ZERO, 0,
 				__builtin_return_address(0));
Signature · 1 line
2.39.2

--
Uladzislau Rezki