Re: [PATCH v1 1/2] bootm: fit: support multiple configuration nodes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 20, 2017 at 01:55:39PM +0100, Oleksij Rempel wrote:
> From: Steffen Trumtrar <s.trumtrar@xxxxxxxxxxxxxx>
> 
> Signed-off-by: Steffen Trumtrar <s.trumtrar@xxxxxxxxxxxxxx>
> Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
> ---
>  common/image-fit.c | 39 +++++++++++++++++++++++++++++++++++++--
>  1 file changed, 37 insertions(+), 2 deletions(-)
> 
> diff --git a/common/image-fit.c b/common/image-fit.c
> index 6a01c614c..48c021347 100644
> --- a/common/image-fit.c
> +++ b/common/image-fit.c
> @@ -489,6 +489,37 @@ static int fit_config_verify_signature(struct fit_handle *handle, struct device_
>  	return ret;
>  }
>  
> +static int fit_find_compatible_unit(struct device_node *conf_node,
> +				    const char **unit)
> +{
> +	struct device_node *child = NULL;
> +	struct device_node *barebox_root;
> +	const char *machine;
> +	int ret;
> +
> +	barebox_root = of_get_root_node();
> +	if (!barebox_root)
> +		return -ENOSYS;
> +
> +	ret = of_property_read_string(barebox_root, "compatible", &machine);
> +	if (ret)
> +		return -ENOENT;
> +
> +	for_each_child_of_node(conf_node, child) {
> +		if (of_device_is_compatible(child, machine)) {
> +			*unit = xasprintf("%s", child->name);

This is never freed. *unit is a const char * in the caller.

Sascha

-- 
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 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux