[U-Boot] Early malloc() summary

Graeme Russ
2012-08-16T11:39:00Z

Hi Marek,

On 08/15/2012 09:56 AM, Marek Vasut wrote:
> Dear Graeme Russ,
>
> [...]
>
>>
>> Third path is dm_malloc() - Although ugly, it has a few nicities...
>
> Thinking about dm_malloc() ... if it's entirely different, the semantics can be
> adjusted too ... say to "int dm_malloc(void **ptr, size_t size);":
>
> - return int: error code
> - **ptr: pointer to allocated memory, that way we can possibly implement pointer
> tracking (of course that'd need more work, might be a debug feature)
> - size: size of allocated area

I think we should keep the semantics as close as possible to malloc(). If
there is an error, return NULL. For starters, if we do later go with a
common malloc() which gets wrapped, changing the code will be a lot easier.

Regards,

Graeme