[U-Boot] [PATCH v8] [RFC] early_malloc for DM added.

Marek Vasut marex at denx.de
Mon Sep 24 01:11:57 CEST 2012


Dear Tomas Hlavacek,

[..]
> +
> +	if (early_malloc_active()) {
> +		addr = early_malloc(size);
> +		for (i=0; i<size; i++)
> +			addr[i] = 0;

memset() ?

> +
> +		return addr;
> +	}
> +#endif /* CONFIG_SYS_EARLY_MALLOC */
> +	return calloc(n, elem_size);
> +}
> +
> +static inline void *dmrealloc(void *oldmem, size_t bytes)
> +{
> +#ifdef CONFIG_SYS_EARLY_MALLOC
> +	if (early_malloc_active())
> +		return NULL;

I wonder how should this be implemented ... maybe early_malloc + standard 
memcpy()

> +#endif /* CONFIG_SYS_EARLY_MALLOC */
> +	return dmrealloc(oldmem, bytes);
> +}
> +
> +#endif /* CONFIG_DM */
> +#endif /* __INCLUDE_DMMALLOC_H */
> +

Best regards,
Marek Vasut


More information about the U-Boot mailing list