Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1254590

Re: [PATCH] of/fdt: fix error checking for earlycon address

From Peter Hurley <peter@hurleysoftware.com>
Newsgroups linux.kernel
Subject Re: [PATCH] of/fdt: fix error checking for earlycon address
Date 2015-10-23 15:20 +0200
Message-ID <qmKqe-2uc-11@gated-at.bofh.it> (permalink)
References <qmJ18-lc-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Masahiro,

On 10/23/2015 07:47 AM, Masahiro Yamada wrote:
> fdt_translate_address() returns OF_BAD_ADDR on error.  It is defined as
> a u64 value, so the variable "addr" should be defined as u64 as well.

Good catch.

I would prefer if fdt_translate_address() returned resource_size_t (which
is the proper type for handling addresses as integers) and that type
was propagated through early_init_dt_scan_chosen_serial => of_setup_earlycon.

Regards,
Peter Hurley


PS - It seems that there is a new user of fdt_translate_address() in the
nios arch:

commit e8bf5bc776edef44777b13b2eb4461d653519bae
Author: Ley Foon Tan <lftan@altera.com>
Date:   Tue Feb 10 23:21:08 2015 +0800

    nios2: add early printk support
    
    Signed-off-by: Ley Foon Tan <lftan@altera.com>

I've copied the author as that should have been an earlycon in the
altera uart driver(s) rather than early_printk. Oh well.


> Fixes: fb11ffe74c79 ("of/fdt: add FDT serial scanning for earlycon")
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
>  drivers/of/fdt.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 9fc3568..196e449 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -822,14 +822,15 @@ static int __init early_init_dt_scan_chosen_serial(void)
>  		return -ENODEV;
>  
>  	while (match->compatible[0]) {
> -		unsigned long addr;
> +		u64 addr;
> +
>  		if (fdt_node_check_compatible(fdt, offset, match->compatible)) {
>  			match++;
>  			continue;
>  		}
>  
>  		addr = fdt_translate_address(fdt, offset);
> -		if (!addr)
> +		if (addr == OF_BAD_ADDR)
>  			return -ENXIO;
>  
>  		of_setup_earlycon(addr, match->data);
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] of/fdt: fix error checking for earlycon address Masahiro Yamada <yamada.masahiro@socionext.com> - 2015-10-23 13:50 +0200
  Re: [PATCH] of/fdt: fix error checking for earlycon address Peter Hurley <peter@hurleysoftware.com> - 2015-10-23 15:20 +0200
    Re: [PATCH] of/fdt: fix error checking for earlycon address Rob Herring <robh@kernel.org> - 2015-10-27 21:50 +0100
      Re: [PATCH] of/fdt: fix error checking for earlycon address Peter Hurley <peter@hurleysoftware.com> - 2015-10-28 16:00 +0100
  Re: [PATCH] of/fdt: fix error checking for earlycon address Rob Herring <robh@kernel.org> - 2015-10-29 05:10 +0100

csiph-web