treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / scripts / dtc / libfdt / fdt_empty_tree.c
blob49d54d44b8e78be6d110c41db97312ef66ff89aa
1 // SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause)
2 /*
3 * libfdt - Flat Device Tree manipulation
4 * Copyright (C) 2012 David Gibson, IBM Corporation.
5 */
6 #include "libfdt_env.h"
8 #include <fdt.h>
9 #include <libfdt.h>
11 #include "libfdt_internal.h"
13 int fdt_create_empty_tree(void *buf, int bufsize)
15 int err;
17 err = fdt_create(buf, bufsize);
18 if (err)
19 return err;
21 err = fdt_finish_reservemap(buf);
22 if (err)
23 return err;
25 err = fdt_begin_node(buf, "");
26 if (err)
27 return err;
29 err = fdt_end_node(buf);
30 if (err)
31 return err;
33 err = fdt_finish(buf);
34 if (err)
35 return err;
37 return fdt_open_into(buf, buf, bufsize);