[PATCH] of: base: add chosen node if it does not exist when adding initrd

Sascha Hauer s.hauer at pengutronix.de
Sun Dec 11 21:47:28 PST 2016


On Thu, Dec 08, 2016 at 11:15:51AM +0100, Philipp Zabel wrote:
> If the chosen node does not exist, of_add_initrd fails to pass the
> initrd to the kernel. Instead it should create the chosen node, just
> like of_fixup_bootargs does.
> 
> Signed-off-by: Philipp Zabel <p.zabel at pengutronix.de>
> ---
>  drivers/of/base.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 767d4e1..0c20fcd 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -2019,9 +2019,9 @@ int of_add_initrd(struct device_node *root, resource_size_t start,
>  	struct device_node *chosen;
>  	__be32 buf[2];
>  
> -	chosen = of_find_node_by_path_from(root, "/chosen");
> +	chosen = of_create_node(root, "/chosen");
>  	if (!chosen)
> -		return -EINVAL;
> +		return -ENOMEM;
>  
>  	if (end) {
>  		of_write_number(buf, start, 2);
> -- 
> 2.10.2
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list