diff mbox series

[v2,10/10] lib/cmdline_kunit: Remove a cast which are no-longer required

Message ID 20210513193204.816681-10-davidgow@google.com
State Accepted
Commit 255ede3b129041eae4edfdce121cedbfabfdd30e
Headers show
Series [v2,01/10] kunit: Do not typecheck binary assertions | expand

Commit Message

David Gow May 13, 2021, 7:32 p.m. UTC
With some of the stricter type checking in KUnit's EXPECT macros
removed, a cast in cmdline_kunit is no longer required.

Remove the unnecessary cast, using NULL instead of (int *) to make it
clearer.

Signed-off-by: David Gow <davidgow@google.com>
---
This should be a no-op functionality wise, and while it depends on the
first couple of patches in this series, it's otherwise independent from
the others. I think this makes the test more readable, but if you
particularly dislike it, I'm happy to drop it.

 lib/cmdline_kunit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andy Shevchenko May 17, 2021, 6:52 a.m. UTC | #1
On Fri, May 14, 2021 at 2:32 AM David Gow <davidgow@google.com> wrote:
>

> With some of the stricter type checking in KUnit's EXPECT macros

> removed, a cast in cmdline_kunit is no longer required.

>

> Remove the unnecessary cast, using NULL instead of (int *) to make it

> clearer.


Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>


> Signed-off-by: David Gow <davidgow@google.com>

> ---

> This should be a no-op functionality wise, and while it depends on the

> first couple of patches in this series, it's otherwise independent from

> the others. I think this makes the test more readable, but if you

> particularly dislike it, I'm happy to drop it.

>

>  lib/cmdline_kunit.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

>

> diff --git a/lib/cmdline_kunit.c b/lib/cmdline_kunit.c

> index 018bfc8113c4..a72a2c16066e 100644

> --- a/lib/cmdline_kunit.c

> +++ b/lib/cmdline_kunit.c

> @@ -124,7 +124,7 @@ static void cmdline_do_one_range_test(struct kunit *test, const char *in,

>                             n, e[0], r[0]);

>

>         p = memchr_inv(&r[1], 0, sizeof(r) - sizeof(r[0]));

> -       KUNIT_EXPECT_PTR_EQ_MSG(test, p, (int *)0, "in test %u at %u out of bound", n, p - r);

> +       KUNIT_EXPECT_PTR_EQ_MSG(test, p, NULL, "in test %u at %u out of bound", n, p - r);

>  }

>

>  static void cmdline_test_range(struct kunit *test)

> --

> 2.31.1.751.gd2f1c929bd-goog

>



-- 
With Best Regards,
Andy Shevchenko
Brendan Higgins June 15, 2021, 8:42 p.m. UTC | #2
On Thu, May 13, 2021 at 12:36 PM David Gow <davidgow@google.com> wrote:
>

> With some of the stricter type checking in KUnit's EXPECT macros

> removed, a cast in cmdline_kunit is no longer required.

>

> Remove the unnecessary cast, using NULL instead of (int *) to make it

> clearer.

>

> Signed-off-by: David Gow <davidgow@google.com>


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

Patch

diff --git a/lib/cmdline_kunit.c b/lib/cmdline_kunit.c
index 018bfc8113c4..a72a2c16066e 100644
--- a/lib/cmdline_kunit.c
+++ b/lib/cmdline_kunit.c
@@ -124,7 +124,7 @@  static void cmdline_do_one_range_test(struct kunit *test, const char *in,
 			    n, e[0], r[0]);
 
 	p = memchr_inv(&r[1], 0, sizeof(r) - sizeof(r[0]));
-	KUNIT_EXPECT_PTR_EQ_MSG(test, p, (int *)0, "in test %u at %u out of bound", n, p - r);
+	KUNIT_EXPECT_PTR_EQ_MSG(test, p, NULL, "in test %u at %u out of bound", n, p - r);
 }
 
 static void cmdline_test_range(struct kunit *test)