Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH v1] selftests:tdx:Use min macro
@ 2024-08-22  4:46 Yan Zhen
  2024-08-22  6:35 ` Shuah Khan
  2024-08-27 12:34 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Yan Zhen @ 2024-08-22  4:46 UTC (permalink / raw)
  To: shuah; +Cc: linux-kselftest, linux-kernel, opensource.kernel, Yan Zhen

Using the min macro is usually more intuitive and readable.

Signed-off-by: Yan Zhen <yanzhen@vivo.com>
---
 tools/testing/selftests/tdx/tdx_guest_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/tdx/tdx_guest_test.c b/tools/testing/selftests/tdx/tdx_guest_test.c
index 81d8cb88e..d7ddf5307 100644
--- a/tools/testing/selftests/tdx/tdx_guest_test.c
+++ b/tools/testing/selftests/tdx/tdx_guest_test.c
@@ -118,7 +118,7 @@ static void print_array_hex(const char *title, const char *prefix_str,
 	printf("\t\t%s", title);
 
 	for (j = 0; j < len; j += rowsize) {
-		line_len = rowsize < (len - j) ? rowsize : (len - j);
+		line_len = min((len - j), rowsize);
 		printf("%s%.8x:", prefix_str, j);
 		for (i = 0; i < line_len; i++)
 			printf(" %.2x", ptr[j + i]);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-27 12:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-22  4:46 [PATCH v1] selftests:tdx:Use min macro Yan Zhen
2024-08-22  6:35 ` Shuah Khan
2024-08-27 12:34 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox