From a7aebb6dac3287374721dd2101a4584f12c63c82 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 29 Aug 2003 19:16:13 +0000 Subject: Add DRM(calloc), which is convenient, used by the new sis code, and takes advantage of M_ZERO on BSDs. --- linux-core/drm_memory.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'linux-core/drm_memory.h') diff --git a/linux-core/drm_memory.h b/linux-core/drm_memory.h index 4ac7bac5..59e86b0c 100644 --- a/linux-core/drm_memory.h +++ b/linux-core/drm_memory.h @@ -226,6 +226,18 @@ void *DRM(alloc)(size_t size, int area) return kmalloc(size, GFP_KERNEL); } +/** Wrapper around kmalloc() */ +void *DRM(calloc)(size_t size, size_t nmemb, int area) +{ + void *addr; + + addr = kmalloc(size * nmemb, GFP_KERNEL); + if (addr != NULL) + memset((void *)addr, 0, size * nmemb); + + return addr; +} + /** Wrapper around kmalloc() and kfree() */ void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, int area) { -- cgit v1.2.3