remove function _rtw_zvmalloc

Remove the function _rtw_zvmalloc from os_dep/osdep_service.c, as this
function is now unused and is just an inline wrapper around vmalloc
which zeroes out the memory. All previous callers have been converted to
use vzalloc. Also remove the declaration from include/osdep_service.h.

It is considered generally bad practice to declare functions as inline in
the majority of cases, as not only can this qualifier be ignored by the
compiler but the compiler generally makes good decisions about inlining
anyway.

Link: https://lore.kernel.org/r/20210818234853.208448-7-phil@philpotter.co.uk
This commit is contained in:
Phillip Potter
2021-08-19 00:48:52 +01:00
committed by Carlos Garcés
parent 9f0e896c35
commit 3255bcf093
2 changed files with 0 additions and 81 deletions

View File

@@ -65,26 +65,6 @@ u32 rtw_atoi(u8 *s)
}
inline void *_rtw_zvmalloc(u32 sz)
{
void *pbuf;
#ifdef PLATFORM_LINUX
pbuf = vmalloc(sz);
if (pbuf != NULL)
memset(pbuf, 0, sz);
#endif
#ifdef PLATFORM_FREEBSD
pbuf = malloc(sz, M_DEVBUF, M_ZERO | M_NOWAIT);
#endif
#ifdef PLATFORM_WINDOWS
NdisAllocateMemoryWithTag(&pbuf, sz, RT_TAG);
if (pbuf != NULL)
NdisFillMemory(pbuf, sz, 0);
#endif
return pbuf;
}
void *_rtw_malloc(u32 sz)
{
void *pbuf = NULL;
@@ -514,42 +494,6 @@ bool match_mstat_sniff_rules(const enum mstat_f flags, const size_t size)
return _FALSE;
}
inline void *dbg_rtw_vmalloc(u32 sz, const enum mstat_f flags, const char *func, const int line)
{
void *p;
if (match_mstat_sniff_rules(flags, sz))
RTW_INFO("DBG_MEM_ALLOC %s:%d %s(%d)\n", func, line, __FUNCTION__, (sz));
p = vmalloc(sz);
rtw_mstat_update(
flags
, p ? MSTAT_ALLOC_SUCCESS : MSTAT_ALLOC_FAIL
, sz
);
return p;
}
inline void *dbg_rtw_zvmalloc(u32 sz, const enum mstat_f flags, const char *func, const int line)
{
void *p;
if (match_mstat_sniff_rules(flags, sz))
RTW_INFO("DBG_MEM_ALLOC %s:%d %s(%d)\n", func, line, __FUNCTION__, (sz));
p = _rtw_zvmalloc((sz));
rtw_mstat_update(
flags
, p ? MSTAT_ALLOC_SUCCESS : MSTAT_ALLOC_FAIL
, sz
);
return p;
}
inline void dbg_rtw_vmfree(void *pbuf, u32 sz, const enum mstat_f flags, const char *func, const int line)
{