From: Lucas De Marchi <lucas.demarchi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>,
Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH i-g-t v3 5/6] lib/igt_ktap: Just free ktap
Date: Wed, 6 Nov 2024 21:52:53 -0800 [thread overview]
Message-ID: <20241107055254.3129207-6-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20241107055254.3129207-1-lucas.demarchi@intel.com>
Change function signature so it only set the pointer free rather than
also setting it to NULL. This matches alloc/free behavior for other
objects in igt.
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
lib/igt_kmod.c | 2 +-
lib/igt_ktap.c | 5 ++---
lib/igt_ktap.h | 2 +-
lib/tests/igt_ktap_parser.c | 24 ++++++++++++------------
4 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index fd79e8739..7be95a61c 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -1026,7 +1026,7 @@ static int kunit_get_results(struct igt_list_head *results, const char *debugfs_
}
free(buf);
- igt_ktap_free(&ktap);
+ igt_ktap_free(ktap);
out_fclose:
fclose(results_stream);
diff --git a/lib/igt_ktap.c b/lib/igt_ktap.c
index 300fb2bb5..aa7ea8447 100644
--- a/lib/igt_ktap.c
+++ b/lib/igt_ktap.c
@@ -310,8 +310,7 @@ struct igt_ktap_results *igt_ktap_alloc(struct igt_list_head *results)
return ktap;
}
-void igt_ktap_free(struct igt_ktap_results **ktap)
+void igt_ktap_free(struct igt_ktap_results *ktap)
{
- free(*ktap);
- *ktap = NULL;
+ free(ktap);
}
diff --git a/lib/igt_ktap.h b/lib/igt_ktap.h
index 7684e859b..c422636bf 100644
--- a/lib/igt_ktap.h
+++ b/lib/igt_ktap.h
@@ -41,6 +41,6 @@ struct igt_ktap_results;
struct igt_ktap_results *igt_ktap_alloc(struct igt_list_head *results);
int igt_ktap_parse(const char *buf, struct igt_ktap_results *ktap);
-void igt_ktap_free(struct igt_ktap_results **ktap);
+void igt_ktap_free(struct igt_ktap_results *ktap);
#endif /* IGT_KTAP_H */
diff --git a/lib/tests/igt_ktap_parser.c b/lib/tests/igt_ktap_parser.c
index 8c2d16080..6357bdf6a 100644
--- a/lib/tests/igt_ktap_parser.c
+++ b/lib/tests/igt_ktap_parser.c
@@ -45,7 +45,7 @@ static void ktap_list(void)
igt_assert_eq(igt_ktap_parse(" ok 4 test_case_4 # SKIP\n", ktap), -EINPROGRESS);
igt_assert_eq(igt_ktap_parse("ok 3 test_suite_3\n", ktap), 0);
- igt_ktap_free(&ktap);
+ igt_ktap_free(ktap);
igt_assert_eq(igt_list_length(&results), 8);
@@ -107,7 +107,7 @@ static void ktap_results(void)
igt_assert_eq(igt_ktap_parse(" ok 1 test_case\n", ktap), -EINPROGRESS);
igt_assert_eq(igt_ktap_parse("not ok 1 test_suite\n", ktap), 0);
- igt_ktap_free(&ktap);
+ igt_ktap_free(ktap);
igt_assert_eq(igt_list_length(&results), 2);
@@ -162,7 +162,7 @@ static void ktap_success(void)
igt_assert_eq(igt_ktap_parse("not ok 1 test_suite\n", ktap), 0);
igt_assert_eq(igt_list_length(&results), 2);
- igt_ktap_free(&ktap);
+ igt_ktap_free(ktap);
result = igt_list_last_entry(&results, result, link);
igt_list_del(&result->link);
@@ -186,48 +186,48 @@ static void ktap_top_version(void)
ktap = igt_ktap_alloc(&results);
igt_require(ktap);
igt_assert_eq(igt_ktap_parse("1..1\n", ktap), -EPROTO);
- igt_ktap_free(&ktap);
+ igt_ktap_free(ktap);
ktap = igt_ktap_alloc(&results);
igt_require(ktap);
/* TODO: change to -EPROTO as soon as related workaround is dropped */
igt_assert_eq(igt_ktap_parse(" KTAP version 1\n", ktap), -EINPROGRESS);
- igt_ktap_free(&ktap);
+ igt_ktap_free(ktap);
ktap = igt_ktap_alloc(&results);
igt_require(ktap);
igt_assert_eq(igt_ktap_parse(" # Subtest: test_suite\n", ktap), -EPROTO);
- igt_ktap_free(&ktap);
+ igt_ktap_free(ktap);
ktap = igt_ktap_alloc(&results);
igt_require(ktap);
igt_assert_eq(igt_ktap_parse(" 1..1\n", ktap), -EPROTO);
- igt_ktap_free(&ktap);
+ igt_ktap_free(ktap);
ktap = igt_ktap_alloc(&results);
igt_require(ktap);
igt_assert_eq(igt_ktap_parse(" KTAP version 1\n", ktap), -EPROTO);
- igt_ktap_free(&ktap);
+ igt_ktap_free(ktap);
ktap = igt_ktap_alloc(&results);
igt_require(ktap);
igt_assert_eq(igt_ktap_parse(" # Subtest: test_case\n", ktap), -EPROTO);
- igt_ktap_free(&ktap);
+ igt_ktap_free(ktap);
ktap = igt_ktap_alloc(&results);
igt_require(ktap);
igt_assert_eq(igt_ktap_parse(" ok 1 parameter 1\n", ktap), -EPROTO);
- igt_ktap_free(&ktap);
+ igt_ktap_free(ktap);
ktap = igt_ktap_alloc(&results);
igt_require(ktap);
igt_assert_eq(igt_ktap_parse(" ok 1 test_case\n", ktap), -EPROTO);
- igt_ktap_free(&ktap);
+ igt_ktap_free(ktap);
ktap = igt_ktap_alloc(&results);
igt_require(ktap);
igt_assert_eq(igt_ktap_parse("ok 1 test_suite\n", ktap), -EPROTO);
- igt_ktap_free(&ktap);
+ igt_ktap_free(ktap);
}
igt_main
--
2.47.0
next prev parent reply other threads:[~2024-11-07 5:53 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 5:52 [PATCH i-g-t v3 0/6] lib/igt_kmod: Drop legacy kunit integration Lucas De Marchi
2024-11-07 5:52 ` [PATCH i-g-t v3 1/6] lib/igt_kmod: Drop legacy kunit fallback Lucas De Marchi
2024-11-07 5:52 ` [PATCH i-g-t v3 2/6] lib/igt_kmod: Fix leaking subtest name Lucas De Marchi
2024-11-07 5:52 ` [PATCH i-g-t v3 3/6] lib/igt_kmod: Stop passing debugfs_dir around Lucas De Marchi
2024-11-14 14:24 ` Janusz Krzysztofik
2024-11-14 20:58 ` Lucas De Marchi
2024-11-14 21:45 ` Lucas De Marchi
2024-11-15 14:24 ` Janusz Krzysztofik
2024-11-07 5:52 ` [PATCH i-g-t v3 4/6] lib/igt_kmod: Stop passing ktap around Lucas De Marchi
2024-11-14 15:00 ` Janusz Krzysztofik
2024-11-07 5:52 ` Lucas De Marchi [this message]
2024-11-14 15:02 ` [PATCH i-g-t v3 5/6] lib/igt_ktap: Just free ktap Janusz Krzysztofik
2024-11-07 5:52 ` [PATCH i-g-t v3 6/6] lib/igt_kmod: Do not leak kmod ctx Lucas De Marchi
2024-11-14 17:06 ` Janusz Krzysztofik
2024-11-07 6:22 ` ✓ CI.xeBAT: success for lib/igt_kmod: Drop legacy kunit integration (rev3) Patchwork
2024-11-07 6:27 ` ✓ Fi.CI.BAT: " Patchwork
2024-11-07 7:29 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-11-08 11:25 ` ✗ CI.xeFULL: " Patchwork
2024-11-14 22:00 ` ✗ Fi.CI.BUILD: failure for lib/igt_kmod: Drop legacy kunit integration (rev4) Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241107055254.3129207-6-lucas.demarchi@intel.com \
--to=lucas.demarchi@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=janusz.krzysztofik@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox