Skip to content

Commit

Permalink
memblock tests: fix undefined reference to `panic'
Browse files Browse the repository at this point in the history
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 <richard.weiyang@gmail.com>
CC: Song Shuai <songshuaishuai@tinylab.org>
CC: Mike Rapoport <rppt@kernel.org>
Link: https://lore.kernel.org/r/20240402132701.29744-3-richard.weiyang@gmail.com
Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
  • Loading branch information
Wei Yang authored and Mike Rapoport (IBM) committed Apr 4, 2024
1 parent 7d8ed16 commit e0f5a8e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions tools/include/linux/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
19 changes: 19 additions & 0 deletions tools/include/linux/panic.h
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e0f5a8e

Please sign in to comment.