Commit 70deca9f authored by Mike Frysinger's avatar Mike Frysinger
Browse files

Blackfin: convert malloc()/memset() to zalloc() in module code


Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
parent dc6b1ac9
...@@ -98,14 +98,13 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, ...@@ -98,14 +98,13 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
if (strcmp(".l1.bss", secstrings + s->sh_name) == 0 || if (strcmp(".l1.bss", secstrings + s->sh_name) == 0 ||
((strcmp(".bss", secstrings + s->sh_name) == 0) && ((strcmp(".bss", secstrings + s->sh_name) == 0) &&
(hdr->e_flags & EF_BFIN_DATA_IN_L1) && (s->sh_size > 0))) { (hdr->e_flags & EF_BFIN_DATA_IN_L1) && (s->sh_size > 0))) {
dest = l1_data_sram_alloc(s->sh_size); dest = l1_data_sram_zalloc(s->sh_size);
mod->arch.bss_a_l1 = dest; mod->arch.bss_a_l1 = dest;
if (dest == NULL) { if (dest == NULL) {
pr_err("L1 data memory allocation failed\n", pr_err("L1 data memory allocation failed\n",
mod->name); mod->name);
return -1; return -1;
} }
memset(dest, 0, s->sh_size);
s->sh_flags &= ~SHF_ALLOC; s->sh_flags &= ~SHF_ALLOC;
s->sh_addr = (unsigned long)dest; s->sh_addr = (unsigned long)dest;
} }
...@@ -164,14 +163,13 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, ...@@ -164,14 +163,13 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
if (strcmp(".l2.bss", secstrings + s->sh_name) == 0 || if (strcmp(".l2.bss", secstrings + s->sh_name) == 0 ||
((strcmp(".bss", secstrings + s->sh_name) == 0) && ((strcmp(".bss", secstrings + s->sh_name) == 0) &&
(hdr->e_flags & EF_BFIN_DATA_IN_L2) && (s->sh_size > 0))) { (hdr->e_flags & EF_BFIN_DATA_IN_L2) && (s->sh_size > 0))) {
dest = l2_sram_alloc(s->sh_size); dest = l2_sram_zalloc(s->sh_size);
mod->arch.bss_l2 = dest; mod->arch.bss_l2 = dest;
if (dest == NULL) { if (dest == NULL) {
pr_err("L2 SRAM allocation failed\n", pr_err("L2 SRAM allocation failed\n",
mod->name); mod->name);
return -1; return -1;
} }
memset(dest, 0, s->sh_size);
s->sh_flags &= ~SHF_ALLOC; s->sh_flags &= ~SHF_ALLOC;
s->sh_addr = (unsigned long)dest; s->sh_addr = (unsigned long)dest;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment