File kernel-fix-empty-nv_memdbg_add.patch of Package nvidia-gfxG05
Index: kernel/common/inc/nv-linux.h
===================================================================
--- kernel.orig/common/inc/nv-linux.h
+++ kernel/common/inc/nv-linux.h
@@ -518,7 +518,9 @@ static inline void *nv_vmalloc(unsigned
void *ptr = __vmalloc(size, GFP_KERNEL);
#endif
if (ptr)
+ {
NV_MEMDBG_ADD(ptr, size);
+ }
return ptr;
}
@@ -532,7 +534,9 @@ static inline void *nv_ioremap(NvU64 phy
{
void *ptr = ioremap(phys, size);
if (ptr)
+ {
NV_MEMDBG_ADD(ptr, size);
+ }
return ptr;
}
@@ -546,7 +550,9 @@ static inline void *nv_ioremap_cache(NvU
#if defined(NV_IOREMAP_CACHE_PRESENT)
void *ptr = ioremap_cache(phys, size);
if (ptr)
+ {
NV_MEMDBG_ADD(ptr, size);
+ }
return ptr;
#elif defined(NVCPU_PPC64LE)
//
@@ -564,7 +570,9 @@ static inline void *nv_ioremap_cache(NvU
//
void *ptr = ioremap_prot(phys, size, pgprot_val(PAGE_KERNEL));
if (ptr)
+ {
NV_MEMDBG_ADD(ptr, size);
+ }
return ptr;
#else
return nv_ioremap(phys, size);
@@ -576,7 +584,9 @@ static inline void *nv_ioremap_wc(NvU64
#if defined(NV_IOREMAP_WC_PRESENT)
void *ptr = ioremap_wc(phys, size);
if (ptr)
+ {
NV_MEMDBG_ADD(ptr, size);
+ }
return ptr;
#else
return nv_ioremap_nocache(phys, size);
@@ -604,14 +614,18 @@ static NvBool nv_numa_node_has_memory(in
{ \
(ptr) = kmalloc(size, NV_GFP_KERNEL); \
if (ptr) \
+ { \
NV_MEMDBG_ADD(ptr, size); \
+ } \
}
#define NV_KMALLOC_ATOMIC(ptr, size) \
{ \
(ptr) = kmalloc(size, NV_GFP_ATOMIC); \
if (ptr) \
+ { \
NV_MEMDBG_ADD(ptr, size); \
+ } \
}
#if defined(__GFP_RETRY_MAYFAIL)
@@ -626,7 +640,9 @@ static NvBool nv_numa_node_has_memory(in
{ \
(ptr) = kmalloc(size, NV_GFP_NO_OOM); \
if (ptr) \
+ { \
NV_MEMDBG_ADD(ptr, size); \
+ } \
}
#define NV_KFREE(ptr, size) \
@@ -663,7 +679,9 @@ static inline NvUPtr nv_vmap(struct page
/* All memory cached in PPC64LE; can't honor 'cached' input. */
ptr = vmap(pages, page_count, VM_MAP, prot);
if (ptr)
+ {
NV_MEMDBG_ADD(ptr, page_count * PAGE_SIZE);
+ }
return (NvUPtr)ptr;
}