From: Wei Yang <richard.weiyang@gmail.com>
To: akpm@linux-foundation.org, rppt@kernel.org, rongtao@cestc.cn
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Wei Yang <richard.weiyang@gmail.com>,
Song Shuai <songshuaishuai@tinylab.org>
Subject: [PATCH 2/3] memblock tests: fix undefined reference to `panic'
Date: Tue, 2 Apr 2024 13:27:00 +0000 [thread overview]
Message-ID: <20240402132701.29744-3-richard.weiyang@gmail.com> (raw)
In-Reply-To: <20240402132701.29744-1-richard.weiyang@gmail.com>
commit e96c6b8f212a ("memblock: report failures when memblock_can_resize
is not set") introduced the usage of panic, which is not defined in
memblock test.
Let's define it directly in panic.h to fix it.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Song Shuai <songshuaishuai@tinylab.org>
CC: Mike Rapoport <rppt@kernel.org>
---
tools/include/linux/kernel.h | 1 +
tools/include/linux/panic.h | 19 +++++++++++++++++++
2 files changed, 20 insertions(+)
create mode 100644 tools/include/linux/panic.h
diff --git a/tools/include/linux/kernel.h b/tools/include/linux/kernel.h
index 4b0673bf52c2..07cfad817d53 100644
--- a/tools/include/linux/kernel.h
+++ b/tools/include/linux/kernel.h
@@ -8,6 +8,7 @@
#include <linux/build_bug.h>
#include <linux/compiler.h>
#include <linux/math.h>
+#include <linux/panic.h>
#include <endian.h>
#include <byteswap.h>
diff --git a/tools/include/linux/panic.h b/tools/include/linux/panic.h
new file mode 100644
index 000000000000..9c8f17a41ce8
--- /dev/null
+++ b/tools/include/linux/panic.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _TOOLS_LINUX_PANIC_H
+#define _TOOLS_LINUX_PANIC_H
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static inline void panic(const char *fmt, ...)
+{
+ va_list argp;
+
+ va_start(argp, fmt);
+ vfprintf(stderr, fmt, argp);
+ va_end(argp);
+ exit(-1);
+}
+
+#endif
--
2.34.1
next prev parent reply other threads:[~2024-04-02 13:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-02 13:26 [PATCH 0/3] memblock tests: fix build error Wei Yang
2024-04-02 13:26 ` [PATCH 1/3] memblock tests: fix undefined reference to `early_pfn_to_nid' Wei Yang
2024-04-02 13:27 ` Wei Yang [this message]
2024-04-02 13:27 ` [PATCH 3/3] memblock tests: fix undefined reference to `BIT' Wei Yang
2024-04-02 19:09 ` [PATCH 0/3] memblock tests: fix build error Mike Rapoport
2024-04-03 22:30 ` Andrew Morton
2024-04-04 9:31 ` Mike Rapoport
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=20240402132701.29744-3-richard.weiyang@gmail.com \
--to=richard.weiyang@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rongtao@cestc.cn \
--cc=rppt@kernel.org \
--cc=songshuaishuai@tinylab.org \
/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