Skip to contentSkip to conversation

m68k: mm: Remove superfluous memblock_alloc*() casts

PATCH In review Geert Uytterhoeven 3 participants 4 messages Aug 26, 2020 – Sep 7, 2020 m68k architecture

lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

PATCH 1/1 m68k: mm: Remove superfluous memblock_alloc*() casts

The return type of memblock_alloc*() is a void pointer, so there is no need to cast it to "void *" or some other pointer type, before assigning it to a pointer variable.

---
 arch/m68k/mm/mcfmmu.c   | 2 +-
 arch/m68k/mm/motorola.c | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)
arch/m68k/mm/mcfmmu.c +1 -1
index 2b9cb4a622811390..eac9dde65193443e 100644
@@ -42,7 +42,7 @@ void __init paging_init(void)
 	unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0 };
 	int i;
 
-	empty_zero_page = (void *) memblock_alloc(PAGE_SIZE, PAGE_SIZE);
+	empty_zero_page = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
 	if (!empty_zero_page)
 		panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
 		      __func__, PAGE_SIZE, PAGE_SIZE);
arch/m68k/mm/motorola.c +2 -3
index a9bdde54ca350197..3a653f0a4188d4af 100644
@@ -227,7 +227,7 @@ static pte_t * __init kernel_page_table(void)
 	pte_t *pte_table = last_pte_table;
 
 	if (PAGE_ALIGNED(last_pte_table)) {
-		pte_table = (pte_t *)memblock_alloc_low(PAGE_SIZE, PAGE_SIZE);
+		pte_table = memblock_alloc_low(PAGE_SIZE, PAGE_SIZE);
 		if (!pte_table) {
 			panic("%s: Failed to allocate %lu bytes align=%lx\n",
 					__func__, PAGE_SIZE, PAGE_SIZE);
@@ -275,8 +275,7 @@ static pmd_t * __init kernel_ptr_table(void)
 
 	last_pmd_table += PTRS_PER_PMD;
 	if (PAGE_ALIGNED(last_pmd_table)) {
-		last_pmd_table = (pmd_t *)memblock_alloc_low(PAGE_SIZE,
-							   PAGE_SIZE);
+		last_pmd_table = memblock_alloc_low(PAGE_SIZE, PAGE_SIZE);
 		if (!last_pmd_table)
 			panic("%s: Failed to allocate %lu bytes align=%lx\n",
 			      __func__, PAGE_SIZE, PAGE_SIZE);
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Geert Uytterhoeven

The return type of memblock_alloc*() is a void pointer, so there is no need to cast it to "void *" or some other pointer type, before assigning it to a pointer variable.

Quoted 44 lines
---
 arch/m68k/mm/mcfmmu.c   | 2 +-
 arch/m68k/mm/motorola.c | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)
arch/m68k/mm/mcfmmu.c +1 -1
index 2b9cb4a622811390..eac9dde65193443e 100644
@@ -42,7 +42,7 @@ void __init paging_init(void)
 	unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0 };
 	int i;
 
-	empty_zero_page = (void *) memblock_alloc(PAGE_SIZE, PAGE_SIZE);
+	empty_zero_page = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
 	if (!empty_zero_page)
 		panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
 		      __func__, PAGE_SIZE, PAGE_SIZE);
arch/m68k/mm/motorola.c +2 -3
index a9bdde54ca350197..3a653f0a4188d4af 100644
@@ -227,7 +227,7 @@ static pte_t * __init kernel_page_table(void)
 	pte_t *pte_table = last_pte_table;
 
 	if (PAGE_ALIGNED(last_pte_table)) {
-		pte_table = (pte_t *)memblock_alloc_low(PAGE_SIZE, PAGE_SIZE);
+		pte_table = memblock_alloc_low(PAGE_SIZE, PAGE_SIZE);
 		if (!pte_table) {
 			panic("%s: Failed to allocate %lu bytes align=%lx\n",
 					__func__, PAGE_SIZE, PAGE_SIZE);
@@ -275,8 +275,7 @@ static pmd_t * __init kernel_ptr_table(void)
 
 	last_pmd_table += PTRS_PER_PMD;
 	if (PAGE_ALIGNED(last_pmd_table)) {
-		last_pmd_table = (pmd_t *)memblock_alloc_low(PAGE_SIZE,
-							   PAGE_SIZE);
+		last_pmd_table = memblock_alloc_low(PAGE_SIZE, PAGE_SIZE);
 		if (!last_pmd_table)
 			panic("%s: Failed to allocate %lu bytes align=%lx\n",
 			      __func__, PAGE_SIZE, PAGE_SIZE);
Signature · 1 line
2.17.1
Signature · 2 lines
Sincerely yours,
Mike.
Acked-by on v1 1/1
#2 lore raw
In reply to Geert Uytterhoeven

Hi Geert,

Quoted 5 lines · Geert Uytterhoeven

The return type of memblock_alloc*() is a void pointer, so there is no need to cast it to "void *" or some other pointer type, before assigning it to a pointer variable.

Regards
Greg

Quoted 41 lines
  arch/m68k/mm/mcfmmu.c   | 2 +-
  arch/m68k/mm/motorola.c | 5 ++---
  2 files changed, 3 insertions(+), 4 deletions(-)
arch/m68k/mm/mcfmmu.c +1 -1
index 2b9cb4a622811390..eac9dde65193443e 100644
@@ -42,7 +42,7 @@ void __init paging_init(void)
  	unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0 };
  	int i;
 
-	empty_zero_page = (void *) memblock_alloc(PAGE_SIZE, PAGE_SIZE);
+	empty_zero_page = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
  	if (!empty_zero_page)
  		panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
  		      __func__, PAGE_SIZE, PAGE_SIZE);
arch/m68k/mm/motorola.c +2 -3
index a9bdde54ca350197..3a653f0a4188d4af 100644
@@ -227,7 +227,7 @@ static pte_t * __init kernel_page_table(void)
  	pte_t *pte_table = last_pte_table;
 
  	if (PAGE_ALIGNED(last_pte_table)) {
-		pte_table = (pte_t *)memblock_alloc_low(PAGE_SIZE, PAGE_SIZE);
+		pte_table = memblock_alloc_low(PAGE_SIZE, PAGE_SIZE);
  		if (!pte_table) {
  			panic("%s: Failed to allocate %lu bytes align=%lx\n",
  					__func__, PAGE_SIZE, PAGE_SIZE);
@@ -275,8 +275,7 @@ static pmd_t * __init kernel_ptr_table(void)
 
  	last_pmd_table += PTRS_PER_PMD;
  	if (PAGE_ALIGNED(last_pmd_table)) {
-		last_pmd_table = (pmd_t *)memblock_alloc_low(PAGE_SIZE,
-							   PAGE_SIZE);
+		last_pmd_table = memblock_alloc_low(PAGE_SIZE, PAGE_SIZE);
  		if (!last_pmd_table)
  			panic("%s: Failed to allocate %lu bytes align=%lx\n",
  			      __func__, PAGE_SIZE, PAGE_SIZE);
author maintainer
#3 lore raw
In reply to Geert Uytterhoeven
Quoted 5 lines · Geert Uytterhoeven

The return type of memblock_alloc*() is a void pointer, so there is no need to cast it to "void *" or some other pointer type, before assigning it to a pointer variable.

Thanks, queueing in the m68k for-v5.10 branch.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds