]> Git Repo - J-u-boot.git/blame - lib/panic.c
configs: Resync with savedefconfig
[J-u-boot.git] / lib / panic.c
CommitLineData
2b22a99c
SS
1/*
2 * linux/lib/vsprintf.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 */
6
7/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */
8/*
9 * Wirzenius wrote this portably, Torvalds fucked it up :-)
10 */
11
12#include <common.h>
db41d65a 13#include <hang.h>
2b22a99c
SS
14#if !defined(CONFIG_PANIC_HANG)
15#include <command.h>
16#endif
c05ed00a 17#include <linux/delay.h>
2b22a99c
SS
18
19static void panic_finish(void) __attribute__ ((noreturn));
20
21static void panic_finish(void)
22{
23 putc('\n');
24#if defined(CONFIG_PANIC_HANG)
25 hang();
26#else
27 udelay(100000); /* allow messages to go out */
28 do_reset(NULL, 0, 0, NULL);
29#endif
30 while (1)
31 ;
32}
33
34void panic_str(const char *str)
35{
36 puts(str);
37 panic_finish();
38}
39
40void panic(const char *fmt, ...)
41{
4f1eed75 42#if CONFIG_IS_ENABLED(PRINTF)
2b22a99c
SS
43 va_list args;
44 va_start(args, fmt);
45 vprintf(fmt, args);
46 va_end(args);
4f1eed75 47#endif
2b22a99c
SS
48 panic_finish();
49}
e21c03be
AK
50
51void __assert_fail(const char *assertion, const char *file, unsigned int line,
52 const char *function)
53{
54 /* This will not return */
55 panic("%s:%u: %s: Assertion `%s' failed.", file, line, function,
56 assertion);
57}
This page took 0.250851 seconds and 4 git commands to generate.