From: Anatolij Gustschin <agust@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 01/11] fdt: Allow ft_board_setup() to report failure
Date: Fri, 17 Oct 2014 22:19:56 +0200 [thread overview]
Message-ID: <20141017221956.5b132587@crub> (raw)
In-Reply-To: <1413360341-25828-1-git-send-email-sjg@chromium.org>
Hi Simon,
some comments on return values and error reporting below:
On Wed, 15 Oct 2014 02:05:31 -0600
Simon Glass <sjg@chromium.org> wrote:
...
> diff --git a/board/amcc/sequoia/sequoia.c b/board/amcc/sequoia/sequoia.c
> index 53f9b34..afac3f9 100644
> --- a/board/amcc/sequoia/sequoia.c
> +++ b/board/amcc/sequoia/sequoia.c
> @@ -10,6 +10,7 @@
> */
>
> #include <common.h>
> +#include <errno.h>
> #include <libfdt.h>
> #include <fdt_support.h>
> #include <asm/ppc4xx.h>
> @@ -363,7 +364,7 @@ void board_pci_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
> * On NAND-booting sequoia, we need to patch the chips select numbers
> * in the dtb (CS0 - NAND, CS3 - NOR)
> */
> -void ft_board_setup(void *blob, bd_t *bd)
> +int ft_board_setup(void *blob, bd_t *bd)
> {
> int rc;
> int len;
> @@ -381,7 +382,7 @@ void ft_board_setup(void *blob, bd_t *bd)
> prop = fdt_get_property_w(blob, nodeoffset, "reg", &len);
> if (prop == NULL) {
> printf("Unable to update NOR chip select for NAND booting\n");
> - return;
> + return -ENOSPC;
return -FDT_ERR_NOSPACE;
otherwise failure reporting of ft_board_setup() as added in the next
patch will output "<unknown error>".
...
> @@ -389,7 +390,7 @@ void ft_board_setup(void *blob, bd_t *bd)
> if (rc) {
> printf("Unable to update property NOR mappings, err=%s\n",
> fdt_strerror(rc));
> - return;
> + return -ENOSPC;
since the failure reporting will be added, it should be removed here:
printf("Unable to update property NOR mappings\n");
return rc;
...
> @@ -398,7 +399,7 @@ void ft_board_setup(void *blob, bd_t *bd)
> prop = fdt_get_property_w(blob, nodeoffset, "reg", &len);
> if (prop == NULL) {
> printf("Unable to update NDFC chip select for NAND booting\n");
> - return;
> + return -ENOSPC;
return -FDT_ERR_NOSPACE;
...
> @@ -406,7 +407,9 @@ void ft_board_setup(void *blob, bd_t *bd)
> if (rc) {
> printf("Unable to update property NDFC mappings, err=%s\n",
> fdt_strerror(rc));
> - return;
> + return -ENOSPC;
printf("Unable to update property NDFC mappings\n");
return rc;
...
> diff --git a/board/freescale/p1_p2_rdb/p1_p2_rdb.c b/board/freescale/p1_p2_rdb/p1_p2_rdb.c
> index aba4f53..e1883ea 100644
> --- a/board/freescale/p1_p2_rdb/p1_p2_rdb.c
> +++ b/board/freescale/p1_p2_rdb/p1_p2_rdb.c
> @@ -6,6 +6,7 @@
>
> #include <common.h>
> #include <command.h>
> +#include <errno.h>
> #include <asm/processor.h>
> #include <asm/mmu.h>
> #include <asm/cache.h>
> @@ -234,7 +235,7 @@ int board_eth_init(bd_t *bis)
> #if defined(CONFIG_OF_BOARD_SETUP)
> extern void ft_pci_board_setup(void *blob);
>
> -void ft_board_setup(void *blob, bd_t *bd)
> +int ft_board_setup(void *blob, bd_t *bd)
> {
> const char *soc_usb_compat = "fsl-usb2-dr";
> int err, usb1_off, usb2_off;
> @@ -266,14 +267,14 @@ void ft_board_setup(void *blob, bd_t *bd)
> printf("WARNING: could not find compatible node"
> " %s: %s.\n", soc_elbc_compat,
> fdt_strerror(off));
> - return;
> + return -ENOENT;
printf("WARNING: could not find compatible node %s\n", soc_elbc_compat);
return off;
> }
> err = fdt_del_node(blob, off);
> if (err < 0) {
> printf("WARNING: could not remove %s: %s.\n",
> soc_elbc_compat, fdt_strerror(err));
> }
> - return;
> + return -ENOSPC;
if (err < 0) {
printf("WARNING: could not remove %s\n", soc_elbc_compat);
return err;
}
return 0;
> }
> #endif
> /* Delete USB2 node as it is muxed with eLBC */
> @@ -283,7 +284,7 @@ void ft_board_setup(void *blob, bd_t *bd)
> printf("WARNING: could not find compatible node"
> " %s: %s.\n", soc_usb_compat,
> fdt_strerror(usb1_off));
> - return;
> + return -ENOSPC;
printf("WARNING: could not find compatible node %s\n", soc_usb_compat);
return usb1_off;
> }
> usb2_off = fdt_node_offset_by_compatible(blob, usb1_off,
> soc_usb_compat);
> @@ -291,11 +292,16 @@ void ft_board_setup(void *blob, bd_t *bd)
> printf("WARNING: could not find compatible node"
> " %s: %s.\n", soc_usb_compat,
> fdt_strerror(usb2_off));
> - return;
> + return -ENOSPC;
printf("WARNING: could not find compatible node %s\n", soc_usb_compat);
return usb2_off;
> }
> err = fdt_del_node(blob, usb2_off);
> - if (err < 0)
> + if (err < 0) {
> printf("WARNING: could not remove %s: %s.\n",
> soc_usb_compat, fdt_strerror(err));
> + return -EINVAL;
printf("WARNING: could not remove %s\n", soc_usb_compat);
return err;
> + }
> +
> + return 0;
> }
> +
> #endif
...
> diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> index a6756c6..5a0b41d 100644
> --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> @@ -6,6 +6,7 @@
>
> #include <common.h>
> #include <command.h>
> +#include <errno.h>
> #include <hwconfig.h>
> #include <pci.h>
> #include <i2c.h>
> @@ -424,7 +425,7 @@ static void fdt_board_fixup_qe_pins(void *blob)
> #endif
>
> #ifdef CONFIG_OF_BOARD_SETUP
> -void ft_board_setup(void *blob, bd_t *bd)
> +int ft_board_setup(void *blob, bd_t *bd)
> {
> phys_addr_t base;
> phys_size_t size;
> @@ -462,14 +463,15 @@ void ft_board_setup(void *blob, bd_t *bd)
> printf("WARNING: could not find compatible node %s: %s.\n",
> soc_elbc_compat,
> fdt_strerror(off));
> - return;
> + return -ENOENT;
printf("WARNING: could not find compatible node %s\n", soc_elbc_compat);
return off;
> }
> err = fdt_del_node(blob, off);
> if (err < 0) {
> printf("WARNING: could not remove %s: %s.\n",
> soc_elbc_compat, fdt_strerror(err));
> + return -EINVAL;
printf("WARNING: could not remove %s\n", soc_elbc_compat);
return err;
> }
> - return;
> + return 0;
> }
> #endif
>
> @@ -480,7 +482,7 @@ void ft_board_setup(void *blob, bd_t *bd)
> printf("WARNING: could not find compatible node %s: %s.\n",
> soc_usb_compat,
> fdt_strerror(usb1_off));
> - return;
> + return -ENOENT;
printf("WARNING: could not find compatible node %s\n", soc_usb_compat);
return usb1_off;
> }
> usb2_off = fdt_node_offset_by_compatible(blob, usb1_off,
> soc_usb_compat);
> @@ -488,13 +490,15 @@ void ft_board_setup(void *blob, bd_t *bd)
> printf("WARNING: could not find compatible node %s: %s.\n",
> soc_usb_compat,
> fdt_strerror(usb2_off));
> - return;
> + return -ENOENT;
printf("WARNING: could not find compatible node %s\n", soc_usb_compat);
return usb2_off;
> }
> err = fdt_del_node(blob, usb2_off);
> if (err < 0) {
> printf("WARNING: could not remove %s: %s.\n",
> soc_usb_compat, fdt_strerror(err));
> + return -EINVAL;
printf("WARNING: could not remove %s\n", soc_usb_compat);
return err;
Thanks,
Anatolij
next prev parent reply other threads:[~2014-10-17 20:19 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-15 8:05 [U-Boot] [PATCH 01/11] fdt: Allow ft_board_setup() to report failure Simon Glass
2014-10-15 8:05 ` [U-Boot] [PATCH 02/11] fdt: Report failure of ft_board_setup() Simon Glass
2014-10-17 20:23 ` Anatolij Gustschin
2014-10-15 8:05 ` [U-Boot] [PATCH 03/11] fdt: Export the fdt_find_or_add_subnode() function Simon Glass
2014-10-17 21:25 ` Anatolij Gustschin
2014-10-15 8:05 ` [U-Boot] [PATCH 04/11] fdt: Add device tree memory bindings Simon Glass
2014-10-15 8:05 ` [U-Boot] [PATCH 05/11] fdt: Use the correct return types for fdtdec_decode_region() Simon Glass
2014-10-17 21:57 ` Anatolij Gustschin
2014-10-15 8:05 ` [U-Boot] [PATCH 06/11] fdt: Enhance flashmap function to deal with region properties Simon Glass
2014-10-17 21:57 ` Anatolij Gustschin
2014-10-15 8:05 ` [U-Boot] [PATCH 07/11] fdt: Tidy up error handling in image_setup_libfdt() Simon Glass
2014-10-18 8:02 ` Anatolij Gustschin
2014-10-15 8:05 ` [U-Boot] [PATCH 08/11] fdt: Add ft_system_setup() function for system device tree additions Simon Glass
2014-10-17 22:20 ` Anatolij Gustschin
2014-10-15 8:05 ` [U-Boot] [PATCH 09/11] fdt: Change fdt_pack_reg() to static and fix types Simon Glass
2014-10-17 22:16 ` Anatolij Gustschin
2014-10-15 8:05 ` [U-Boot] [PATCH 10/11] fdt: Add a function to decode a named memory region Simon Glass
2014-10-15 8:05 ` [U-Boot] [PATCH 11/11] fdt: Try to use fdt_address_cells()/fdt_size_cells() Simon Glass
2014-10-17 20:19 ` Anatolij Gustschin [this message]
2014-10-21 1:51 ` [U-Boot] [PATCH 01/11] fdt: Allow ft_board_setup() to report failure Simon Glass
2014-10-24 0:59 ` Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141017221956.5b132587@crub \
--to=agust@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox