Commit 7466886b authored by Miguel Ojeda's avatar Miguel Ojeda Committed by Shuah Khan

kunit: take `kunit_assert` as `const`

The `kunit_do_failed_assertion` function passes its
`struct kunit_assert` argument to `kunit_fail`. This one,
in turn, calls its `format` field passing the assert again
as a `const` pointer.

Therefore, the whole chain may be made `const`.
Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
Reviewed-by: default avatarDaniel Latypov <dlatypov@google.com>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 0453f984
...@@ -508,7 +508,7 @@ void __printf(2, 3) kunit_log_append(char *log, const char *fmt, ...); ...@@ -508,7 +508,7 @@ void __printf(2, 3) kunit_log_append(char *log, const char *fmt, ...);
void kunit_do_failed_assertion(struct kunit *test, void kunit_do_failed_assertion(struct kunit *test,
const struct kunit_loc *loc, const struct kunit_loc *loc,
enum kunit_assert_type type, enum kunit_assert_type type,
struct kunit_assert *assert, const struct kunit_assert *assert,
const char *fmt, ...); const char *fmt, ...);
#define KUNIT_ASSERTION(test, assert_type, pass, assert_class, INITIALIZER, fmt, ...) do { \ #define KUNIT_ASSERTION(test, assert_type, pass, assert_class, INITIALIZER, fmt, ...) do { \
......
...@@ -244,7 +244,7 @@ static void kunit_print_string_stream(struct kunit *test, ...@@ -244,7 +244,7 @@ static void kunit_print_string_stream(struct kunit *test,
} }
static void kunit_fail(struct kunit *test, const struct kunit_loc *loc, static void kunit_fail(struct kunit *test, const struct kunit_loc *loc,
enum kunit_assert_type type, struct kunit_assert *assert, enum kunit_assert_type type, const struct kunit_assert *assert,
const struct va_format *message) const struct va_format *message)
{ {
struct string_stream *stream; struct string_stream *stream;
...@@ -284,7 +284,7 @@ static void __noreturn kunit_abort(struct kunit *test) ...@@ -284,7 +284,7 @@ static void __noreturn kunit_abort(struct kunit *test)
void kunit_do_failed_assertion(struct kunit *test, void kunit_do_failed_assertion(struct kunit *test,
const struct kunit_loc *loc, const struct kunit_loc *loc,
enum kunit_assert_type type, enum kunit_assert_type type,
struct kunit_assert *assert, const struct kunit_assert *assert,
const char *fmt, ...) const char *fmt, ...)
{ {
va_list args; va_list args;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment