MOS Source Code
Loading...
Searching...
No Matches
fdt_strerror.c
Go to the documentation of this file.
1// SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause)
2/*
3 * libfdt - Flat Device Tree manipulation
4 * Copyright (C) 2006 David Gibson, IBM Corporation.
5 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6 */
7#include "libfdt_env.h"
8
9#include <fdt.h>
10#include <libfdt.h>
11
12#include "libfdt_internal.h"
13
15 const char *str;
16};
17
18#define FDT_ERRTABENT(val) \
19 [(val)] = { .str = #val, }
20
44#define FDT_ERRTABSIZE ((int)(sizeof(fdt_errtable) / sizeof(fdt_errtable[0])))
45
46const char *fdt_strerror(int errval)
47{
48 if (errval > 0)
49 return "<valid offset/length>";
50 else if (errval == 0)
51 return "<no error>";
52 else if (-errval < FDT_ERRTABSIZE) {
53 const char *s = fdt_errtable[-errval].str;
54
55 if (s)
56 return s;
57 }
58
59 return "<unknown error>";
60}
static struct fdt_errtabent fdt_errtable[]
#define FDT_ERRTABSIZE
#define FDT_ERRTABENT(val)
const char * fdt_strerror(int errval)
#define FDT_ERR_INTERNAL
Definition libfdt.h:77
#define FDT_ERR_BADPHANDLE
Definition libfdt.h:41
#define FDT_ERR_NOSPACE
Definition libfdt.h:26
#define FDT_ERR_EXISTS
Definition libfdt.h:23
#define FDT_ERR_BADPATH
Definition libfdt.h:37
#define FDT_ERR_TRUNCATED
Definition libfdt.h:52
#define FDT_ERR_ALIGNMENT
Definition libfdt.h:105
#define FDT_ERR_BADOFFSET
Definition libfdt.h:33
#define FDT_ERR_BADVALUE
Definition libfdt.h:87
#define FDT_ERR_NOPHANDLES
Definition libfdt.h:97
#define FDT_ERR_BADSTATE
Definition libfdt.h:46
#define FDT_ERR_NOTFOUND
Definition libfdt.h:21
#define FDT_ERR_BADOVERLAY
Definition libfdt.h:92
#define FDT_ERR_BADMAGIC
Definition libfdt.h:56
#define FDT_ERR_BADNCELLS
Definition libfdt.h:83
#define FDT_ERR_BADFLAGS
Definition libfdt.h:101
#define FDT_ERR_BADVERSION
Definition libfdt.h:60
#define FDT_ERR_BADLAYOUT
Definition libfdt.h:69
#define FDT_ERR_BADSTRUCTURE
Definition libfdt.h:65
const char * str