diff mbox series

[v2] kunit: fix checkpatch warning

Message ID 20210303020350.4sahuojkqnkcxquf@smtp.gmail.com (mailing list archive)
State Changes Requested
Delegated to: Shuah Khan
Headers show
Series [v2] kunit: fix checkpatch warning | expand

Commit Message

Lucas Stankus March 3, 2021, 2:03 a.m. UTC
Tidy up code by fixing the following checkpatch warnings:
CHECK: Alignment should match open parenthesis
CHECK: Lines should not end with a '('

Signed-off-by: Lucas Stankus <lucas.p.stankus@gmail.com>
---
Change log v1 -> v2
fixed signed-off-by tag
 lib/kunit/assert.c | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

Comments

Brendan Higgins March 3, 2021, 8:56 p.m. UTC | #1
On Tue, Mar 2, 2021 at 6:03 PM Lucas Stankus <lucas.p.stankus@gmail.com> wrote:
>
> Tidy up code by fixing the following checkpatch warnings:
> CHECK: Alignment should match open parenthesis
> CHECK: Lines should not end with a '('
>
> Signed-off-by: Lucas Stankus <lucas.p.stankus@gmail.com>

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 <davidgow@google.com>\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:

Reviewed-by: Brendan Higgins <brendanhiggins@google.com>

[1] https://stackoverflow.com/questions/18979120/is-it-possible-to-add-a-comment-to-a-diff-file-unified
[2] https://lore.kernel.org/lkml/20210209071034.3268897-1-davidgow@google.com/T/
Lucas Stankus March 4, 2021, 4:35 a.m. UTC | #2
On Wed, Mar 03, 2021 at 12:56:05PM -0800, Brendan Higgins wrote:
> Did you change anything other than fixing the Signed-off-by that Shuah
> requested?

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

> 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 <davidgow@google.com>\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.
Shuah Khan March 4, 2021, 11:12 p.m. UTC | #3
On 3/3/21 9:35 PM, Lucas Stankus wrote:
> On Wed, Mar 03, 2021 at 12:56:05PM -0800, Brendan Higgins wrote:
>> Did you change anything other than fixing the Signed-off-by that Shuah
>> requested?
> 
> No, I only fixed the Signed-off-by warning.
> 
>> 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 <davidgow@google.com>\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.
> 

Thank you both.

I will pick this up.

thanks,
-- Shuah
Shuah Khan March 10, 2021, 3:54 p.m. UTC | #4
On 3/4/21 4:12 PM, Shuah Khan wrote:
> On 3/3/21 9:35 PM, Lucas Stankus wrote:
>> On Wed, Mar 03, 2021 at 12:56:05PM -0800, Brendan Higgins wrote:
>>> Did you change anything other than fixing the Signed-off-by that Shuah
>>> requested?
>>
>> No, I only fixed the Signed-off-by warning.
>>
>>> 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 <davidgow@google.com>\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.
>>
> 

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
diff mbox series

Patch

diff --git a/lib/kunit/assert.c b/lib/kunit/assert.c
index e0ec7d6fed6f..acfbf86bddd6 100644
--- a/lib/kunit/assert.c
+++ b/lib/kunit/assert.c
@@ -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,