Skip to content

Commit e0f5a8e

Browse files
RichardWeiYangrppt
authored andcommitted
memblock tests: fix undefined reference to `panic'
commit e96c6b8 ("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 <[email protected]> CC: Song Shuai <[email protected]> CC: Mike Rapoport <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mike Rapoport (IBM) <[email protected]>
1 parent 7d8ed16 commit e0f5a8e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

tools/include/linux/kernel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/build_bug.h>
99
#include <linux/compiler.h>
1010
#include <linux/math.h>
11+
#include <linux/panic.h>
1112
#include <endian.h>
1213
#include <byteswap.h>
1314

tools/include/linux/panic.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _TOOLS_LINUX_PANIC_H
3+
#define _TOOLS_LINUX_PANIC_H
4+
5+
#include <stdarg.h>
6+
#include <stdio.h>
7+
#include <stdlib.h>
8+
9+
static inline void panic(const char *fmt, ...)
10+
{
11+
va_list argp;
12+
13+
va_start(argp, fmt);
14+
vfprintf(stderr, fmt, argp);
15+
va_end(argp);
16+
exit(-1);
17+
}
18+
19+
#endif

0 commit comments

Comments
 (0)