add kcalloc compat for before 2.6.10
parent
bc4c835731
commit
737c73d1a0
|
@ -107,6 +107,17 @@ static inline int remap_pfn_range(struct vm_area_struct *vma, unsigned long from
|
|||
size,
|
||||
pgprot);
|
||||
}
|
||||
|
||||
static __inline__ void *kcalloc(size_t nmemb, size_t size, int flags)
|
||||
{
|
||||
void *addr;
|
||||
|
||||
addr = kmalloc(size * nmemb, flags);
|
||||
if (addr != NULL)
|
||||
memset((void *)addr, 0, size * nmemb);
|
||||
|
||||
return addr;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
|
||||
|
|
|
@ -134,13 +134,7 @@ int drm_mem_info(char *buf, char **start, off_t offset,
|
|||
/** Wrapper around kmalloc() */
|
||||
void *drm_calloc(size_t nmemb, size_t size, int area)
|
||||
{
|
||||
void *addr;
|
||||
|
||||
addr = kmalloc(size * nmemb, GFP_KERNEL);
|
||||
if (addr != NULL)
|
||||
memset((void *)addr, 0, size * nmemb);
|
||||
|
||||
return addr;
|
||||
return kcalloc(nmemb, size, GFP_KERNEL);
|
||||
}
|
||||
EXPORT_SYMBOL(drm_calloc);
|
||||
|
||||
|
|
Loading…
Reference in New Issue