Skip to contentSkip to conversation

kunit: fix checkpatch warning

PATCH In review Lucas Stankus 3 participants 5 messages Mar 3, 2021 – Mar 10, 2021

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

PATCH v2 1/1 kunit: fix checkpatch warning

Tidy up code by fixing the following checkpatch warnings:
CHECK: Alignment should match open parenthesis
CHECK: Lines should not end with a '('

---
Change log v1 -> v2
fixed signed-off-by tag

 lib/kunit/assert.c | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)
lib/kunit/assert.c +20 -11
index e0ec7d6fed6f..acfbf86bddd6 100644
@@ -25,7 +25,7 @@ void kunit_base_assert_format(const struct kunit_assert *assert,
 	}
 
 	string_stream_add(stream, "%s FAILED at %s:%d\n",
-			 expect_or_assert, assert->file, assert->line);
+			  expect_or_assert, assert->file, assert->line);
 }
 EXPORT_SYMBOL_GPL(kunit_base_assert_format);
 
@@ -48,8 +48,9 @@ EXPORT_SYMBOL_GPL(kunit_fail_assert_format);
 void kunit_unary_assert_format(const struct kunit_assert *assert,
 			       struct string_stream *stream)
 {
-	struct kunit_unary_assert *unary_assert = container_of(
-			assert, struct kunit_unary_assert, assert);
+	struct kunit_unary_assert *unary_assert;
+
+	unary_assert = container_of(assert, struct kunit_unary_assert, assert);
 
 	kunit_base_assert_format(assert, stream);
 	if (unary_assert->expected_true)
@@ -67,8 +68,10 @@ EXPORT_SYMBOL_GPL(kunit_unary_assert_format);
 void kunit_ptr_not_err_assert_format(const struct kunit_assert *assert,
 				     struct string_stream *stream)
 {
-	struct kunit_ptr_not_err_assert *ptr_assert = container_of(
-			assert, struct kunit_ptr_not_err_assert, assert);
+	struct kunit_ptr_not_err_assert *ptr_assert;
+
+	ptr_assert = container_of(assert, struct kunit_ptr_not_err_assert,
+				  assert);
 
 	kunit_base_assert_format(assert, stream);
 	if (!ptr_assert->value) {
@@ -111,8 +114,10 @@ static bool is_literal(struct kunit *test, const char *text, long long value,
 void kunit_binary_assert_format(const struct kunit_assert *assert,
 				struct string_stream *stream)
 {
-	struct kunit_binary_assert *binary_assert = container_of(
-			assert, struct kunit_binary_assert, assert);
+	struct kunit_binary_assert *binary_assert;
+
+	binary_assert = container_of(assert, struct kunit_binary_assert,
+				     assert);
 
 	kunit_base_assert_format(assert, stream);
 	string_stream_add(stream,
@@ -137,8 +142,10 @@ EXPORT_SYMBOL_GPL(kunit_binary_assert_format);
 void kunit_binary_ptr_assert_format(const struct kunit_assert *assert,
 				    struct string_stream *stream)
 {
-	struct kunit_binary_ptr_assert *binary_assert = container_of(
-			assert, struct kunit_binary_ptr_assert, assert);
+	struct kunit_binary_ptr_assert *binary_assert;
+
+	binary_assert = container_of(assert, struct kunit_binary_ptr_assert,
+				     assert);
 
 	kunit_base_assert_format(assert, stream);
 	string_stream_add(stream,
@@ -159,8 +166,10 @@ EXPORT_SYMBOL_GPL(kunit_binary_ptr_assert_format);
 void kunit_binary_str_assert_format(const struct kunit_assert *assert,
 				    struct string_stream *stream)
 {
-	struct kunit_binary_str_assert *binary_assert = container_of(
-			assert, struct kunit_binary_str_assert, assert);
+	struct kunit_binary_str_assert *binary_assert;
+
+	binary_assert = container_of(assert, struct kunit_binary_str_assert,
+				     assert);
 
 	kunit_base_assert_format(assert, stream);
 	string_stream_add(stream,
Signature · 1 line
2.30.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Lucas Stankus

Tidy up code by fixing the following checkpatch warnings:
CHECK: Alignment should match open parenthesis
CHECK: Lines should not end with a '('

Did you change anything other than fixing the Signed-off-by that Shuah requested?

Generally when you make a small change after receiving a Reviewed-by (especially one so small as here), you are supposed to include the Reviewed-by with the other git commit message footers directly below the "Signed-off-by". Please remember to do so in the future.

Also, when you make a change to a patch and send out a subsequent revision, it is best practice to make note explaining the changes you made since the last revision in the "comment section" [1] of the git-diff, right after the three dashes and before the change log as you can see in this example [2] (note that everything after "Signed-off-by: David Gow <[email protected]>\n ---" and before "tools/testing/kunit/configs/broken_on_uml.config | 2 ++" is discarded by git am).

Anyway, aside from these minor points of LKML best practices, this patch still looks good to me:

[1] https://stackoverflow.com/questions/18979120/is-it-possible-to-add-a-comment-to-a-diff-file-unified
[2] https://lore.kernel.org/lkml/[email protected]/T/

#2 lore raw
Quoted 2 lines · Brendan Higgins

Did you change anything other than fixing the Signed-off-by that Shuah requested?

No, I only fixed the Signed-off-by warning.

Quoted 5 lines

Generally when you make a small change after receiving a Reviewed-by (especially one so small as here), you are supposed to include the Reviewed-by with the other git commit message footers directly below the "Signed-off-by". Please remember to do so in the future.

Quoted 8 lines

Also, when you make a change to a patch and send out a subsequent revision, it is best practice to make note explaining the changes you made since the last revision in the "comment section" [1] of the git-diff, right after the three dashes and before the change log as you can see in this example [2] (note that everything after "Signed-off-by: David Gow <[email protected]>\n ---" and before "tools/testing/kunit/configs/broken_on_uml.config | 2 ++" is discarded by git am).

Sorry for the incovenience regarding best practices, I'll keep that noted for further contributions.

maintainer
#3 lore raw
Quoted 20 lines · Lucas Stankus
Quoted 2 lines · Brendan Higgins

Did you change anything other than fixing the Signed-off-by that Shuah requested?

No, I only fixed the Signed-off-by warning.

Quoted 5 lines

Generally when you make a small change after receiving a Reviewed-by (especially one so small as here), you are supposed to include the Reviewed-by with the other git commit message footers directly below the "Signed-off-by". Please remember to do so in the future.

Quoted 8 lines

Also, when you make a change to a patch and send out a subsequent revision, it is best practice to make note explaining the changes you made since the last revision in the "comment section" [1] of the git-diff, right after the three dashes and before the change log as you can see in this example [2] (note that everything after "Signed-off-by: David Gow <[email protected]>\n ---" and before "tools/testing/kunit/configs/broken_on_uml.config | 2 ++" is discarded by git am).

Quoted 3 lines

Sorry for the incovenience regarding best practices, I'll keep that noted for further contributions.

Thank you both.

I will pick this up.

thanks,
-- Shuah

maintainer
#4 lore raw
Quoted 21 lines · Shuah Khan
Quoted 20 lines · Lucas Stankus
Quoted 2 lines · Brendan Higgins

Did you change anything other than fixing the Signed-off-by that Shuah requested?

No, I only fixed the Signed-off-by warning.

Quoted 13 lines

Generally when you make a small change after receiving a Reviewed-by (especially one so small as here), you are supposed to include the Reviewed-by with the other git commit message footers directly below the "Signed-off-by". Please remember to do so in the future.

Also, when you make a change to a patch and send out a subsequent revision, it is best practice to make note explaining the changes you made since the last revision in the "comment section" [1] of the git-diff, right after the three dashes and before the change log as you can see in this example [2] (note that everything after "Signed-off-by: David Gow <[email protected]>\n ---" and before "tools/testing/kunit/configs/broken_on_uml.config | 2 ++" is discarded by git am).

Quoted 4 lines
Quoted 3 lines

Sorry for the incovenience regarding best practices, I'll keep that noted for further contributions.

Sorry I should have asked you about this. I like to see what is being fixed in the subject line.

Can you update the subject line. The current one doesn't say anything about the nature of the fix.

Also please run the checkpatch script on your patches. This tool useful and can offer you tips on improving your commit log as well as code.

thanks,
-- Shuah