summaryrefslogtreecommitdiffstats
path: root/common/dummy_malloc.c
blob: 7a96afec76e01dba56f54b10c70bab1fa9ff29f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2013 Sascha Hauer <s.hauer@pengutronix.de>
 */
#include <common.h>
#include <malloc.h>

void malloc_stats(void)
{
}

void *memalign(size_t alignment, size_t bytes)
{
	void *mem = sbrk(bytes + alignment);

	if (!mem) {
		errno = ENOMEM;
		return NULL;
	}

	return PTR_ALIGN(mem, alignment);
}

void *malloc(size_t size)
{
	return memalign(CONFIG_MALLOC_ALIGNMENT, size);
}

void free(void *ptr)
{
}

void *realloc(void *ptr, size_t size)
{
	BUG();
}