mm/alloc: remove all unnecessary cast for alloc

Fix the minor style issue and remove unnecessary cast

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an
2023-08-28 15:39:47 +08:00
committed by Xiang Xiao
parent db13d5e24c
commit 664927c86e
333 changed files with 485 additions and 566 deletions
+1 -1
View File
@@ -108,7 +108,7 @@ int binfmt_copyargv(FAR char * const **copy, FAR char * const *argv)
if (argsize > 0)
{
argvsize = (nargs + 1) * sizeof(FAR char *);
ptr = (FAR char *)kmm_malloc(argvsize + argsize);
ptr = kmm_malloc(argvsize + argsize);
if (!ptr)
{
berr("ERROR: Failed to allocate the argument buffer\n");
+1 -1
View File
@@ -83,7 +83,7 @@ int exec_spawn(FAR const char *filename, FAR char * const *argv,
/* Allocate the load information */
bin = (FAR struct binary_s *)kmm_zalloc(sizeof(struct binary_s));
bin = kmm_zalloc(sizeof(struct binary_s));
if (!bin)
{
berr("ERROR: Failed to allocate binary_s\n");
+1 -1
View File
@@ -140,7 +140,7 @@ int exec_module(FAR struct binary_s *binp,
/* Allocate a TCB for the new task. */
tcb = (FAR struct task_tcb_s *)kmm_zalloc(sizeof(struct task_tcb_s));
tcb = kmm_zalloc(sizeof(struct task_tcb_s));
if (!tcb)
{
return -ENOMEM;
+1 -1
View File
@@ -138,7 +138,7 @@ int elf_loadctors(FAR struct elf_loadinfo_s *loadinfo)
{
/* Allocate memory to hold a copy of the .ctor section */
loadinfo->ctoralloc = (binfmt_ctor_t *)kumm_malloc(ctorsize);
loadinfo->ctoralloc = kumm_malloc(ctorsize);
if (!loadinfo->ctoralloc)
{
berr("Failed to allocate memory for .ctors\n");
+1 -1
View File
@@ -139,7 +139,7 @@ int elf_loaddtors(FAR struct elf_loadinfo_s *loadinfo)
{
/* Allocate memory to hold a copy of the .dtor section */
loadinfo->dtoralloc = (binfmt_dtor_t *)kumm_malloc(dtorsize);
loadinfo->dtoralloc = kumm_malloc(dtorsize);
if (!loadinfo->dtoralloc)
{
berr("Failed to allocate memory for .dtors\n");
+1 -1
View File
@@ -69,7 +69,7 @@ int elf_allocbuffer(FAR struct elf_loadinfo_s *loadinfo)
{
/* No.. allocate one now */
loadinfo->iobuffer = (FAR uint8_t *)kmm_malloc(CONFIG_ELF_BUFFERSIZE);
loadinfo->iobuffer = kmm_malloc(CONFIG_ELF_BUFFERSIZE);
if (!loadinfo->iobuffer)
{
berr("Failed to allocate an I/O buffer\n");
+1 -1
View File
@@ -204,7 +204,7 @@ int elf_loadshdrs(FAR struct elf_loadinfo_s *loadinfo)
/* Allocate memory to hold a working copy of the sector header table */
loadinfo->shdr = (FAR FAR Elf_Shdr *)kmm_malloc(shdrsize);
loadinfo->shdr = kmm_malloc(shdrsize);
if (!loadinfo->shdr)
{
berr("Failed to allocate the section header table. Size: %zu\n",
+2 -2
View File
@@ -81,7 +81,7 @@ int nxflat_addrenv_alloc(FAR struct nxflat_loadinfo_s *loadinfo,
/* Allocate the struct dspace_s container for the D-Space allocation */
dspace = (FAR struct dspace_s *)kmm_malloc(sizeof(struct dspace_s));
dspace = kmm_malloc(sizeof(struct dspace_s));
if (dspace == 0)
{
berr("ERROR: Failed to allocate DSpace\n");
@@ -163,7 +163,7 @@ errout_with_dspace:
#else
/* Allocate (and zero) memory to hold the ELF image */
dspace->region = (FAR uint8_t *)kumm_zalloc(envsize);
dspace->region = kumm_zalloc(envsize);
if (!dspace->region)
{
kmm_free(dspace);