From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxime Ripard Subject: [PATCH v6 1/4] libfdt: Add new errors for the overlay code Date: Thu, 29 Sep 2016 13:29:05 +0200 Message-ID: <20160929112908.4468-2-maxime.ripard@free-electrons.com> References: <20160929112908.4468-1-maxime.ripard@free-electrons.com> Return-path: In-Reply-To: <20160929112908.4468-1-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> Sender: devicetree-compiler-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: David Gibson Cc: Pantelis Antoniou , Simon Glass , Boris Brezillon , devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Thomas Petazzoni , =?UTF-8?q?Antoine=20T=C3=A9nart?= , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Maxime Ripard Add a few new error codes to report the failure conditions we might encounter in the overlay application code: - FDT_ERR_BADFIXUP, when an overlay fixup property is not properly formatted. - FDT_ERR_BADOVERLAY, when an overlay cannot be parsed, even though its structure is correct - FDT_ERR_NOPHANDLES, when we ran out of available phandles and we cannot use a new phandle without either using an invalid one (-1 or 0), or one already used. Signed-off-by: Maxime Ripard --- libfdt/fdt_strerror.c | 3 +++ libfdt/libfdt.h | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/libfdt/fdt_strerror.c b/libfdt/fdt_strerror.c index e6c3ceee8c58..70a36291466f 100644 --- a/libfdt/fdt_strerror.c +++ b/libfdt/fdt_strerror.c @@ -76,6 +76,9 @@ static struct fdt_errtabent fdt_errtable[] = { FDT_ERRTABENT(FDT_ERR_BADVERSION), FDT_ERRTABENT(FDT_ERR_BADSTRUCTURE), FDT_ERRTABENT(FDT_ERR_BADLAYOUT), + FDT_ERRTABENT(FDT_ERR_BADFIXUP), + FDT_ERRTABENT(FDT_ERR_BADOVERLAY), + FDT_ERRTABENT(FDT_ERR_NOPHANDLES), }; #define FDT_ERRTABSIZE (sizeof(fdt_errtable) / sizeof(fdt_errtable[0])) diff --git a/libfdt/libfdt.h b/libfdt/libfdt.h index ecb11fc9e985..81907815fda1 100644 --- a/libfdt/libfdt.h +++ b/libfdt/libfdt.h @@ -126,7 +126,20 @@ * value. For example: a property expected to contain a string list * is not NUL-terminated within the length of its value. */ -#define FDT_ERR_MAX 15 +#define FDT_ERR_BADFIXUP 16 + /* FDT_ERR_BADFIXUP: One of the device tree overlay fixup is + * not formatted properly. */ + +#define FDT_ERR_BADOVERLAY 17 + /* FDT_ERR_BADOVERLAY: The device tree overlay, while + * correctly structured, cannot be applied due to some + * unexpected or missing value, property or node. */ + +#define FDT_ERR_NOPHANDLES 18 + /* FDT_ERR_NOPHANDLES: The device tree doesn't have any + * phandle available anymore without causing an overflow */ + +#define FDT_ERR_MAX 18 /**********************************************************************/ /* Low-level functions (you probably don't need these) */ -- 2.9.3